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
We expect that the capture function should have the following attributes: name=name and assign=assign.
As the template includes {$assign}, we expect that: <div>Do I appear?</div> should appear.
Actual behaviour:
Nothing will appear!
The compiled template code mixes up the order of the statements so that the 'if' in the assign attribute is only evaluated if the first if in the name attribute is false. <?php ob_start();?><?php if (true){?><?php echo "name";?><?php }else{?><?php ob_start();?><?php if (true){?><?php echo "assign";?><?php }?><?php $_$ <div>Do I appear?</div> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
The error in compilation occurs:
When we need to pass variables to a smarty function such as 'capture'. The error also occurs with other inbuilt smarty functions and custom functions.
When an if statement is followed by an elif statement. The if statement is evaluated in one 'attribute' and the elif statement is evaluate on another 'attribute'.
The text was updated successfully, but these errors were encountered:
I've found an interesting error in the compilation of templates in smarty 3.1.21
To reproduce use the following in a template file:
{capture assign="{if true}assign{/if}" name="{if true}name{elseif false}isnt-the-name{/if}"} <div>Do I appear?</div> {/capture} {$assign}
Expected behaviour:
We expect that the capture function should have the following attributes: name=name and assign=assign.
As the template includes {$assign}, we expect that:
<div>Do I appear?</div>
should appear.Actual behaviour:
Nothing will appear!
The compiled template code mixes up the order of the statements so that the 'if' in the assign attribute is only evaluated if the first if in the name attribute is false.
<?php ob_start();?><?php if (true){?><?php echo "name";?><?php }else{?><?php ob_start();?><?php if (true){?><?php echo "assign";?><?php }?><?php $_$ <div>Do I appear?</div> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
The error in compilation occurs:
The text was updated successfully, but these errors were encountered: