From dbda42bc6cf603ca1a4e36bd78baf4d208d01b53 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Tue, 4 Oct 2011 16:18:24 +0000 Subject: [PATCH] - bugfix assign() in plugins called in subtemplates did change value also in parent template --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_data.php | 26 ++++++++---------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/change_log.txt b/change_log.txt index f61d470b..a52159fe 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +04.10.2011 +- bugfix assign() in plugins called in subtemplates did change value also in parent template + ===== Smarty-3.1.2 ===== 03.10.2011 - improvement add internal $joined_template_dir property instead computing it on the fly several times diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 6d8aaae9..5baf3b76 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -56,25 +56,15 @@ class Smarty_Internal_Data { if (is_array($tpl_var)) { foreach ($tpl_var as $_key => $_val) { if ($_key != '') { - if (isset($this->tpl_vars[$_key])) { - $this->tpl_vars[$_key]->value = $_val; - $this->tpl_vars[$_key]->nocache = $nocache; - } else { - $this->tpl_vars[$_key] = new Smarty_variable($_val, $nocache); - } + $this->tpl_vars[$_key] = new Smarty_variable($_val, $nocache); } } } else { if ($tpl_var != '') { - if (isset($this->tpl_vars[$tpl_var])) { - $this->tpl_vars[$tpl_var]->value = $value; - $this->tpl_vars[$tpl_var]->nocache = $nocache; - } else { - $this->tpl_vars[$tpl_var] = new Smarty_variable($value, $nocache); - } + $this->tpl_vars[$tpl_var] = new Smarty_variable($value, $nocache); } } - + return $this; } @@ -91,7 +81,7 @@ class Smarty_Internal_Data { if ($varname != '') { Smarty::$global_tpl_vars[$varname] = new Smarty_variable($value, $nocache); } - + return $this; } /** @@ -108,7 +98,7 @@ class Smarty_Internal_Data { $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache); $this->tpl_vars[$tpl_var]->value = &$value; } - + return $this; } @@ -169,7 +159,7 @@ class Smarty_Internal_Data { } } } - + return $this; } @@ -198,7 +188,7 @@ class Smarty_Internal_Data { $this->tpl_vars[$tpl_var]->value[] = &$value; } } - + return $this; } @@ -262,7 +252,7 @@ class Smarty_Internal_Data { } else { unset($this->tpl_vars[$tpl_var]); } - + return $this; }