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
When trying to read from undefined/unassigned variable there is no warning triggered, because Smarty always converts any unassigned and null variables into an empty string.
These is the option $smarty->error_unassigned = true, it enables Warning about accessing an unassigned variable.
But! This is not useful because it triggers Warning even when you check a variable with isset(...)
{if isset($variable)} - results in Warning when error_unassigned = true
IMO when checking a variable with isset() then it should not trigger a warning because you explicitly check for variable existence.
This is especially uncomfortable when you develop new big form and you don't know what variables you didn't pass yet.
Checked in Smarty version 5.3.1.
Seems like current version also has this problem.
The text was updated successfully, but these errors were encountered:
There is a problem within Smarty compiler {if isset($foo) } ..... {/if}
will be compiled (v5.4.1) into <?php if ((null !== ($_smarty_tpl->getValue('foo') ?? null))) {?> ..... <?php }?>
but it should be <?php if ((null !== ($_smarty_tpl->hasVariable('foo') ?? null))) {?> ..... <?php }?>
When trying to read from undefined/unassigned variable there is no warning triggered, because Smarty always converts any unassigned and null variables into an empty string.
These is the option $smarty->error_unassigned = true, it enables Warning about accessing an unassigned variable.
But! This is not useful because it triggers Warning even when you check a variable with isset(...)
{if isset($variable)} - results in Warning when error_unassigned = true
IMO when checking a variable with isset() then it should not trigger a warning because you explicitly check for variable existence.
This is especially uncomfortable when you develop new big form and you don't know what variables you didn't pass yet.
Checked in Smarty version 5.3.1.
Seems like current version also has this problem.
The text was updated successfully, but these errors were encountered: