using php function time in template should display a warning
Fixes #1114
How about libs/sysplugins/smarty_internal_templatecompilerbase.php:662:
if (
!$this->smarty->loadPlugin('smarty_modifiercompiler_' . $name)
&& !isset($this->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$name])
&& !in_array($name, ['time', 'join', 'is_array', 'in_array', 'count'])
) {
trigger_error('Using unregistered function "' . $name . '" in a template is deprecated and will be ' .
'removed in a future release. Use Smarty::registerPlugin to explicitly register ' .
'a custom modifier.', E_USER_DEPRECATED);
}
I don't get it, this is the modification I proposed.
Edit: did you mean libs/sysplugins/smarty_internal_compile_private_modifier.php:112 ?:
if (!in_array($modifier, ['time', 'join', 'is_array', 'in_array'])) {
trigger_error('Using unregistered function "' . $modifier . '" in a template is deprecated and will be ' .
'removed in a future release. Use Smarty::registerPlugin to explicitly register ' .
'a custom modifier.', E_USER_DEPRECATED);
}
To be honest I don't know what is the use of this part of code.
Not only it does not change the behaviour of displaying a warning or not for time() but it contrary to libs/sysplugins/smarty_internal_templatecompilerbase.php:662 it does not check against 'count' and currently usage of {count($var)} or {$var|count} in template work correctly without deprecation warnings
Sorry, my bad. Copied the wrong reference. I meant to reference this: libs/sysplugins/smarty_internal_compile_private_modifier.php:112:
if (!is_object($compiler->smarty->security_policy)
|| $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
) {
if (!in_array($modifier, ['time', 'join', 'is_array', 'in_array'])) {
trigger_error('Using unregistered function "' . $modifier . '" in a template is deprecated and will be ' .
'removed in a future release. Use Smarty::registerPlugin to explicitly register ' .
'a custom modifier.', E_USER_DEPRECATED);
}
$output = "{$modifier}({$params})";
}