Skip to content
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

Fatal error: Cannot unset string offsets in vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php on line 337 #46

Closed
Gamesh opened this issue May 29, 2015 · 13 comments

Comments

@Gamesh
Copy link

Gamesh commented May 29, 2015

smarty v.3.1.24

Stack trace:

10  87.0320 22877960    Smarty->fetch( string(17), null, null, null, bool, bool, bool ) .../ViewRenderer.php:84
11  87.0320 22882448    Smarty_Internal_Template->render( bool, bool, bool )    .../Smarty.class.php:824
12  87.0380 22909816    Smarty_Template_Compiled->render( object(Smarty_Internal_Template)[1804] )  .../smarty_internal_template.php:246
13  87.0380 22910424    Smarty_Template_Compiled->process( object(Smarty_Internal_Template)[1804] ) .../smarty_template_compiled.php:199
14  87.0380 22910768    Smarty_Template_Compiled->compileTemplateSource( object(Smarty_Internal_Template)[1804] )   .../smarty_template_compiled.php:152
15  87.0415 22958584    Smarty_Internal_TemplateCompilerBase->compileTemplate( object(Smarty_Internal_Template)[1804], ???, ??? )   .../smarty_template_compiled.php:226
16  87.0434 22966104    Smarty_Internal_SmartyTemplateCompiler->doCompile( string(4272), bool ) .../smarty_internal_templatecompilerbase.php:396
17  87.0689 24537000    Smarty_Internal_Templateparser->doParse( long, string(1) )  .../smarty_internal_smartytemplatecompiler.php:114
18  87.0689 24537584    Smarty_Internal_Templateparser->yy_reduce( long )   .../smarty_internal_templateparser.php:2398
19  87.0689 24537792    Smarty_Internal_Templateparser->yy_r57( )   .../smarty_internal_templateparser.php:2303
20  87.0689 24538008    Smarty_Internal_TemplateCompilerBase->compileTag( string(10), array(0), ??? )   .../smarty_internal_templateparser.php:1585
21  87.0690 24538368    Smarty_Internal_TemplateCompilerBase->compileTag2( string(10), array(0), array(0) ) .../smarty_internal_templatecompilerbase.php:462
22  87.0690 24538416    Smarty_Internal_TemplateCompilerBase->callTagCompiler( string(10), array(0), array(0), ???, ??? )   .../smarty_internal_templatecompilerbase.php:495
23  87.0690 24541352    Smarty_Internal_Compile_Blockclose->compile( array(0), object(Smarty_Internal_SmartyTemplateCompiler)[1814], array(0), null, null ) .../smarty_internal_templatecompilerbase.php:761
@Gamesh
Copy link
Author

Gamesh commented May 29, 2015

v3.1.21 does not have this bug, works fine.

@SvenRtbg
Copy link
Contributor

You should probably add the (template or other) code that triggers this error.

@uwetews
Copy link
Contributor

uwetews commented May 30, 2015

Please provide example code

@uwetews
Copy link
Contributor

uwetews commented May 31, 2015

I can't reproduce the problem. Do you get it on all templates?

@Gamesh
Copy link
Author

Gamesh commented May 31, 2015

for the time being just in one, i'll provide the templates tomorrow

@Gamesh
Copy link
Author

Gamesh commented Jun 2, 2015

i can't seem to isolate this issue, it's produced by mail tamplate that is rendered using fetch() and before each render clearAllAssign() is issued. tried to reproduce it but currently i can't, it appears to happen only some times. I will try to find how to reproduce it all of the time.
Template:
https://gist.github.com/Gamesh/3cd1a0926227fdceee0e

@uwetews
Copy link
Contributor

uwetews commented Jun 3, 2015

The provided template does not contain any {bock}{/block} tags.
The compiler failed while compiling an inheritance template on {bock}{/block} tags.
Did you modify template files which caused a recompilation?

@Gamesh
Copy link
Author

Gamesh commented Jun 3, 2015

the provided template has one block tag

                                {block "mail_body"}
                                    {$message}
                                {/block}

or am i missing something ?

no, i didn't modify any files, i might have cleared the cached versions and templates_c folder

@uwetews
Copy link
Contributor

uwetews commented Jun 3, 2015

Sorry I did not see the {block} tag. Clearing the templates_c folder does explain the recompile. Can you show your template structure? Where did you include the failing template? Inside other block tags?

@uwetews
Copy link
Contributor

uwetews commented Jun 4, 2015

Even if the root cause of the error message is still unknown I added some extra check to avoid it.
The fix is now in dev-master

@uwetews uwetews closed this as completed Jun 4, 2015
@Gamesh
Copy link
Author

Gamesh commented Jun 4, 2015

that just is the weird thing this template is not included as parent template anywhere. It is just used as standalone template and the block tags were there for future template extending. So even if some other templates change they should not cause this template to recompile as it remains the same and is not being extended or included anywhere, and has not changed for a long time.

@uwetews
Copy link
Contributor

uwetews commented Jun 4, 2015

It did recompile because you cleared templates_c .
Also now the error is clear to me. Caused by a standalone template with {block} tags.
For now either remove the {block} tags until next release or install dev-master.

@Gamesh
Copy link
Author

Gamesh commented Jun 4, 2015

ok, thanks for the fix. i've downgraded to smarty 3.1.21 for now, that was the last version that worked without errors with this template, i'll just wait for the next stable release

think-mcunanan pushed a commit to think-mcunanan/smarty that referenced this issue Mar 22, 2023
Merge release-2.0.5.1 release branch into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants