PDA

View Full Version : Solved Captured another 4.2.5 VB with VBET error



ctrenks
04-06-18, 20:49
Was getting another warning so I created a error reporting to write the template to the log and captured this...



[04-Jun-2018 18:52:57 UTC] $lastpostinfo['lastposter'] = '<!--vBET_SNTA-->' . $lastpostinfo['lastposter'] .'<!--vBET_ENTA-->';
[04-Jun-2018 18:52:57 UTC] PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/allfreec/public_html/phpBB2/includes/class_core.php(4695) : eval()'d code on line 1



What I did was write the template to the log before it failed, took me 3 days but this is the template loading that is throwing the error.

vBET
07-06-18, 01:16
We will investigate it and send you response soon.

vBET
15-06-18, 19:56
We must have different versions of vBulletin because in place described by error log we have } and there should be some plugin execution.
Please give us content of line 4695 in your file /home/allfreec/public_html/phpBB2/includes/class_core.php so we will be able to find which plugin is guilty and look for bug.

ctrenks
17-06-18, 02:11
Starting at 4660, you can see my code to catch the error to the log file throwing off the actual



/**
* Renders the output after preperation.
* @see vB_Template::render()
*
* @param boolean Whether to suppress the HTML comment surrounding option (for JS, etc)
* @return string
*/
protected function render_output($suppress_html_comments = false)
{
//This global statement is here to expose $vbulletin to the templates.
//It must remain in the same function as the template eval
global $vbulletin;
extract($this->registered, EXTR_SKIP | EXTR_REFS);

$actioned = false;
($hook = vBulletinHook::fetch_hook('template_render_output')) ? eval($hook) : false;

if (!$actioned)
{
$template_code = self::fetch_template($this->template);
}

if (strpos($template_code, '$final_rendered') !== false)
{
eval($template_code);
}
else
{
/*
$tcount = 0;
$tst = str_replace("vB_Template_Runtime::fetchStylevar('outertablewidth')","",$template_code,$tcount);
$tst = str_replace("old_explorer","",$template_code,$mcount);
if ($mcount==0&&$tcount==0){
error_log($template_code, 0);
}
*/
eval('$final_rendered = "' . $template_code . '";');
}

vBET
18-06-18, 18:01
Thanks. And this commented code is your code, which returned 1st line of error log?

ctrenks
18-06-18, 18:16
Yes, it would log any template executed, that did not match the two know ones that it was logging. Then it would write the ytemple to the log then be followed by the error message

ctrenks
18-06-18, 18:55
NOt sure if that made sense, I logged every single template load there, then removed them if they did not cause the error with the str replace check.

ctrenks
19-06-18, 16:33
Thanks. And this commented code is your code, which returned 1st line of error log?

error_log($template_code, 0); <- this line writes current $template_code to the log file

As the error is fatal, I had to to write each template code processed, then see what it was before the fatal error is recorded.

vBET
21-06-18, 17:06
$lastpostinfo['lastposter'] = '<!--vBET_SNTA-->' . $lastpostinfo['lastposter'] .'<!--vBET_ENTA-->';
There is no such code in vBET... Did you made any changes in code? Which version do you have (maybe some older)?

ctrenks
22-06-18, 14:50
Must be another template that is using the VBET name in there as no changes are made to VBET 492.

vBET
22-06-18, 16:05
So maybe this code is generated by adding several parts (in loop or some other expression). I will check again, looking just for part of it and let you know.

vBET
23-06-18, 19:03
OK, I found it. I couldn't find it earlier, because in code we have escape characters before '. The code is in file vbenterprisetranslator_functions_hooks.php

$vbulletin->templatecache['forumhome_lastpostby'] =
'$lastpostinfo[\'lastposter\'] = \'<!--vBET_SNTA-->\' . $lastpostinfo[\'lastposter\'] .\'<!--vBET_ENTA-->\';'
.$vbulletin->templatecache['forumhome_lastpostby'];
I cannot reproduce the issue so I'm not able to check solution. Please describe how to reproduce or try to replace the code with the one below. This solution was not checked.

$vbulletin->templatecache['forumhome_lastpostby'] =
'$lastpostinfo[lastposter] = \'<!--vBET_SNTA-->\' . $lastpostinfo[lastposter] .\'<!--vBET_ENTA-->\';'
.$vbulletin->templatecache['forumhome_lastpostby'];

This can be it - error code tells about unexpected ' and since vBulletin puts our code in " (eval('$final_rendered = "' . $template_code . '";');) this could lead to the error. Please tell us, how to reproduce, or check possible solution and send us your status.

ctrenks
25-06-18, 14:31
I can not force the error, i was only able to capture it.. It does happen at least a few times in a couple of days so I will update the code and watch!

vBET
26-06-18, 10:05
Great - we will wait for your info.

ctrenks
27-06-18, 21:38
So far no errors, Looks good

vBET
30-06-18, 09:15
Great. I will mark this bug as solved and include solution in next release. If problems appear again, please let us know.

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Languages translations supported by vBET 4.9.99