diff --git a/change_log.txt b/change_log.txt index 268664d5..39653536 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,8 @@ ===== trunk ===== +30.07.2012 +-bugfix {assign} in a nocache section should not overwrite existing variable values + during compilation (issue 109) + 28.07.2012 - bugfix array access of config variables did not work (Forum Topic 22527) diff --git a/libs/sysplugins/smarty_internal_compile_assign.php b/libs/sysplugins/smarty_internal_compile_assign.php index 0ac3f68c..f2dfedfb 100644 --- a/libs/sysplugins/smarty_internal_compile_assign.php +++ b/libs/sysplugins/smarty_internal_compile_assign.php @@ -39,7 +39,11 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase { if ($compiler->tag_nocache || $compiler->nocache) { $_nocache = 'true'; // create nocache var to make it know for further compiling - $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true); + if (isset($compiler->template->tpl_vars[trim($_attr['var'], "'")])) { + $compiler->template->tpl_vars[trim($_attr['var'], "'")]->nocache = true; + } else { + $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true); + } } // scope setup if (isset($_attr['scope'])) {