- bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler

This commit is contained in:
uwetews
2017-05-27 12:18:43 +02:00
parent ef889c79e0
commit ea93486135
3 changed files with 16 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
27.5.2017
- bugfix change compiled code for registered function and modifiers to called as callable to allow closures
https://github.com/smarty-php/smarty/pull/368
- bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler
21.5.2017
- performance store flag for already required shared plugin functions in static variable or

View File

@@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.32-dev-9';
const SMARTY_VERSION = '3.1.32-dev-10';
/**
* define variable scopes

View File

@@ -41,8 +41,10 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
unset($_attr[ 'nocache' ]);
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) {
$tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
$is_registered = true;
} else {
$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
$is_registered = false;
}
// not cacheable?
$compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ];
@@ -59,9 +61,18 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
}
}
$_params = 'array(' . implode(",", $_paramsArray) . ')';
$function = $tag_info[ 0 ];
// compile code
$output = "call_user_func_array( \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0], array( {$_params},\$_smarty_tpl ) )";
if ($is_registered) {
$output =
"call_user_func_array( \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0], array( {$_params},\$_smarty_tpl ) )";
} else {
$function = $tag_info[ 0 ];
if (!is_array($function)) {
$output = "{$function}({$_params},\$_smarty_tpl)";
} else {
$output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)";
}
}
if (!empty($parameter[ 'modifierlist' ])) {
$output = $compiler->compileTag('private_modifier', array(),
array('modifierlist' => $parameter[ 'modifierlist' ],