From 897d40fe5c733808e3e0607b3e6c9e92e4f3ae59 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Mon, 30 Jul 2012 20:07:51 +0000 Subject: [PATCH] -bugfix {assign} in a nocache section should not overwrite existing variable values during compilation (issue 109) --- change_log.txt | 4 ++++ libs/sysplugins/smarty_internal_compile_assign.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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'])) {