- bugfix when passing an array as default parameter at {function} tag

This commit is contained in:
uwe.tews@googlemail.com
2010-12-14 03:55:31 +00:00
parent f0c95ab79c
commit 2918615377
2 changed files with 5 additions and 2 deletions

View File

@@ -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

View File

@@ -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 = "<?php if (!function_exists('smarty_template_function_{$_name}')) {
function smarty_template_function_{$_name}(\$_smarty_tpl,\$params) {
\$saved_tpl_vars = \$_smarty_tpl->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