You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have "{" and "}" characters set as my delimiters. I made a syntax error and closed my foreach loop with double brackets. { foreach $var as $vars } {* code here *} {{ /foreach }} // <---- SYNTAX ERROR
Not only did Smarty not warn me of the error but it parsed the code and executed. Needless to say this was hard to diagnose because the error spilled out into multiple templates and even my normal php scripts and that was due to the foreach loop using an output buffer layer for each iteration that when unproperly closed and not handled by smarty as error get carried over to general scripts.
The text was updated successfully, but these errors were encountered:
The double brackets cause nested behavior. Smarty probably parses the inner {/foreach} first and then tries to output the "result" of that statement. And there indeed seems to be a relation to #552 here. It's not specifically related to foreach. The following has similar compilation results:
{foreach [1, 2, 3] as $var}
T1 {$var}
{{/foreach}}
{foreach [4,5,6] as $var}
T2 {$var}
{/foreach}
{if true}
T3 {$var}
{{/if}}
{if true}
T4 {$var}
{/if}
I have "{" and "}" characters set as my delimiters. I made a syntax error and closed my foreach loop with double brackets.
{ foreach $var as $vars } {* code here *} {{ /foreach }} // <---- SYNTAX ERROR
Not only did Smarty not warn me of the error but it parsed the code and executed. Needless to say this was hard to diagnose because the error spilled out into multiple templates and even my normal php scripts and that was due to the foreach loop using an output buffer layer for each iteration that when unproperly closed and not handled by smarty as error get carried over to general scripts.
The text was updated successfully, but these errors were encountered: