From 88693d327aa6b2761618775ffaa8c4c0ee0232b8 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Mon, 26 Nov 2012 20:11:10 +0000 Subject: [PATCH] - bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_compile_function.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 4e60ae1f..c90ca219 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +26.11.2012 +- bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) + 24.11.2012 - made SmartyBC loadable via composer (Issue #124) diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index 876b13de..7821d203 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -149,7 +149,8 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $compiler->has_code = false; $output = true; } else { - $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . "tpl_vars = \$saved_tpl_vars;}}?>\n"; + $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . "tpl_vars = \$saved_tpl_vars; +foreach (Smarty::\$global_tpl_vars as \$key => \$value) if(!isset(\$_smarty_tpl->tpl_vars[\$key])) \$_smarty_tpl->tpl_vars[\$key] = \$value;}}?>\n"; } // reset flag that we are compiling a template function $compiler->compiles_template_function = false;