mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-04 03:40:53 +02:00
Using PHP functions as modifiers now triggers a deprecation notice (#814)
Fixes #813
This commit is contained in:
@@ -109,6 +109,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
||||
if (!is_object($compiler->smarty->security_policy)
|
||||
|| $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
|
||||
) {
|
||||
trigger_error('Using php-function "' . $modifier . '" as a modifier 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})";
|
||||
}
|
||||
$compiler->known_modifier_type[ $modifier ] = $type;
|
||||
|
||||
@@ -105,7 +105,7 @@ class Smarty_Security
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $php_modifiers = array('escape', 'count', 'nl2br',);
|
||||
public $php_modifiers = array('escape', 'count', 'sizeof', 'nl2br',);
|
||||
|
||||
/**
|
||||
* This is an array of allowed tags.
|
||||
@@ -328,7 +328,7 @@ class Smarty_Security
|
||||
*
|
||||
* @param string $modifier_name
|
||||
* @param object $compiler compiler object
|
||||
*
|
||||
* @deprecated
|
||||
* @return boolean true if modifier is trusted
|
||||
*/
|
||||
public function isTrustedPhpModifier($modifier_name, $compiler)
|
||||
|
||||
Reference in New Issue
Block a user