From 291861537788d36c4e6f726ac3e9f3800377ca4c Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Tue, 14 Dec 2010 03:55:31 +0000 Subject: [PATCH] - bugfix when passing an array as default parameter at {function} tag --- change_log.txt | 2 ++ libs/sysplugins/smarty_internal_compile_function.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/change_log.txt b/change_log.txt index 9d65b5b1..22cdc65c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,6 @@ ===== SVN trunk ===== +14/12/2010 +- bugfix when passing an array as default parameter at {function} tag 13/12/2010 - bugfix {$smarty.template} in child template did not return right content diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index 54429ebd..01dd5521 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -43,7 +43,8 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase { unset($_attr['name']); $compiler->template->properties['function'][$_name]['parameter'] = array(); foreach ($_attr as $_key => $_data) { - $compiler->template->properties['function'][$_name]['parameter'][$_key] = $_data; + eval ('$tmp='.$_data.';'); + $compiler->template->properties['function'][$_name]['parameter'][$_key] = $tmp; } $compiler->smarty->template_functions[$_name]['parameter'] = $compiler->template->properties['function'][$_name]['parameter']; if ($compiler->template->caching) { @@ -52,7 +53,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase { $output = "tpl_vars; - foreach (\$_smarty_tpl->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(trim(\$value,'\''));}; + foreach (\$_smarty_tpl->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}; foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>"; } // Init temporay context