-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smarty_Internal_TemplateCompilerBase bugfix #350
Comments
I can make a blind patch, as it seems a reasonable change, but if you could write a test demonstating this issue, it would be helpful to prevent future regressions as well. |
After a careful look over the code, your proposed patch doesn't look valid. |
On Wed, 12 Apr 2017 05:41:32 -0700 AnrDaemon ***@***.***> wrote:
After a careful look over the code, your proposed patch doesn't look valid.
The change I've suggested emerged from detailed investigation with a debugger.
I would like to see a real case that trigger your issue before attempting any changes.
The problem occurs during preparations for editing a page template, and indeed, there's no error when the page is actually displayed. So I'm guessing a "fetch", not "display", problem.
The page template begins with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
{mobile_detect nocache}{$ismobile = $ismobile scope=global}
<head>
[lots more omitted]
If that 'nocache' is removed from the first tag, the problem goes away. But then, the page doesn't work properly, of course.
Here's a XDEBUG dump:
( ! ) Warning: array_merge(): Argument #2 is not an array in /var/www/html/cmsms-22/lib/smarty/sysplugins/smarty_internal_templatecompilerbase-ORIGINAL.php on line 667
Call Stack
# Time Memory Function Location
<SNIP>
9 0.2871 5936176 Smarty_Internal_Template->compileTemplateSource( ) ../Content.inc.php:326
10 0.2907 5961632 Smarty_Template_Compiled->compileTemplateSource( object(CMSMS\internal\page_template_parser)[348] ) ../smarty_internal_template.php:512
11 0.2979 6069488 Smarty_Internal_TemplateCompilerBase->compileTemplate( object(CMSMS\internal\page_template_parser)[348], ???, ??? ) ../smarty_template_compiled.php:211
12 0.3013 6078208 Smarty_Internal_TemplateCompilerBase->compileTemplateSource( object(CMSMS\internal\page_template_parser)[348], null, null ) ../smarty_internal_templatecompilerbase-ORIGINAL.php:336
13 0.3014 6080496 Smarty_Internal_SmartyTemplateCompiler->doCompile( string(4264), bool ) ../smarty_internal_templatecompilerbase-ORIGINAL.php:404
14 0.3291 7679136 Smarty_Internal_Templateparser->doParse( long, string(1) ) ../smarty_internal_smartytemplatecompiler.php:114
15 0.3293 7680736 Smarty_Internal_Templateparser->yy_reduce( long ) ../smarty_internal_templateparser.php:2779
16 0.3293 7681232 Smarty_Internal_Templateparser->yy_r30( ) ../smarty_internal_templateparser.php:2684
17 0.3293 7682576 Smarty_Internal_TemplateCompilerBase->compileTag( string(13), array(1), ??? ) ../smarty_internal_templateparser.php:1647
18 0.3293 7685312 Smarty_Internal_TemplateCompilerBase->compileTag2( string(13), array(1), array(0) ) ../smarty_internal_templatecompilerbase-ORIGINAL.php:486
19 0.3359 7693408 array_merge ( array(0), string(9) ) ../smarty_internal_templatecompilerbase-ORIGINAL.php:667
Variables in local scope (#18)
$_output = boolean false
$arg = string ''nocache'' (length=9)
$args = array (size=1)
0 => string ''nocache'' (length=9)
$attribute = Undefined
$base_tag = Undefined
$found = boolean true
$function = boolean false
$k = Undefined
$key = Undefined
$method = Undefined
$mixed = string ''nocache'' (length=9)
$new_args = array (size=0)
empty
$parameter = array (size=0)
empty
$plugin = Undefined
$plugin_object = Undefined
$plugin_type = string 'compiler' (length=8)
$tag = string 'mobile_detect' (length=13)
$v = Undefined
HTH.
Phil
|
The fix is now in the master branch |
Shouldn't that be |
Method compileTag2() in http://github.com/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
includes several merges into a $new_args array. The last such merge omits the array-check included in the others, which causes a crash sometimes. Lines 666 ff. should replicate the other instances in the method:
The text was updated successfully, but these errors were encountered: