Skip to content

Commit

Permalink
Treat callables as callables no matter their origin
Browse files Browse the repository at this point in the history
Should fix smarty-php#273
  • Loading branch information
AnrDaemon committed May 24, 2017
1 parent a49a087 commit d82b5b0
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions libs/sysplugins/smarty_internal_compile_private_modifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,13 @@ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $
case 1:
// registered modifier
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
$function =
$compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
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 (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) {
$output =
sprintf('call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], [ %s ])',
Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params);
$compiler->known_modifier_type[ $modifier ] = $type;
break 2;
}
$compiler->known_modifier_type[ $modifier ] = $type;
break 2;
}
break;
case 2:
Expand Down

0 comments on commit d82b5b0

Please sign in to comment.