From d59870d557844d30ce0609e201e20b91e0cfb5aa Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Mon, 25 Jun 2012 21:46:17 +0000 Subject: [PATCH] - bugfix the default plugin handler did not allow static class methods for modifier (issue 85) --- change_log.txt | 3 +++ .../smarty_internal_compile_private_modifier.php | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index dc1bf275..0876d3e2 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +25.06.2012 +- bugfix the default plugin handler did not allow static class methods for modifier (issue 85) + 24.06.2012 - bugfix escape modifier support for PHP < 5.2.3 (Forum Topic 21176) diff --git a/libs/sysplugins/smarty_internal_compile_private_modifier.php b/libs/sysplugins/smarty_internal_compile_private_modifier.php index d9383a8b..120f3ff1 100644 --- a/libs/sysplugins/smarty_internal_compile_private_modifier.php +++ b/libs/sysplugins/smarty_internal_compile_private_modifier.php @@ -108,7 +108,15 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0]; // check if modifier allowed if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) { - $output = "{$function}({$params})"; + if (!is_array($function)) { + $output = "{$function}({$params})"; + } else { + if (is_object($function[0])) { + $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')'; + } else { + $output = $function[0] . '::' . $function[1] . '(' . $params . ')'; + } + } } if (isset($compiler->template->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || isset($compiler->template->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])) { // was a plugin