From 8d5fab37e8eb897a3851302769ce060ad3346e7b Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Tue, 15 Dec 2009 00:02:10 +0000 Subject: [PATCH] - bugfix on object as array index --- libs/sysplugins/smarty_internal_compile_assign.php | 12 ++++-------- libs/sysplugins/smarty_internal_templateparser.php | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libs/sysplugins/smarty_internal_compile_assign.php b/libs/sysplugins/smarty_internal_compile_assign.php index f2f3c1da..57c4ce70 100644 --- a/libs/sysplugins/smarty_internal_compile_assign.php +++ b/libs/sysplugins/smarty_internal_compile_assign.php @@ -24,7 +24,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase { { $this->compiler = $compiler; $this->required_attributes = array('var', 'value'); - $this->optional_attributes = array('scope', 'nocache', 'index'); + $this->optional_attributes = array('scope', 'nocache', 'smarty_internal_index'); $_nocache = 'null'; $_scope = 'null'; @@ -49,16 +49,12 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase { $_scope = SMARTY_GLOBAL_SCOPE; } } - - if (isset($_attr['index'])) { - $_index = $_attr['index']; - } // compiled output - if (isset($_attr['index'])) { - if ($_attr['index'] == '') { + if (isset($_attr['smarty_internal_index'])) { + if ($_attr['smarty_internal_index'] == '') { return "append($_attr[var],$_attr[value],false,$_nocache,$_scope);?>"; } else { - return "append($_attr[var],\$_tmp,true,$_nocache,$_scope); unset (\$_tmp);?>"; + return "append($_attr[var],\$_tmp,true,$_nocache,$_scope); unset (\$_tmp);?>"; } } else { return "assign($_attr[var],$_attr[value],$_nocache,$_scope);?>"; diff --git a/libs/sysplugins/smarty_internal_templateparser.php b/libs/sysplugins/smarty_internal_templateparser.php index e4207b17..7d2e5fa4 100644 --- a/libs/sysplugins/smarty_internal_templateparser.php +++ b/libs/sysplugins/smarty_internal_templateparser.php @@ -2091,7 +2091,7 @@ static public $yy_action = array( function yy_r90(){ $this->prefix_number++; $this->compiler->prefix_code[] = ''.$this->yystack[$this->yyidx + 0]->minor.'prefix_number.'=ob_get_clean();?>'; $this->_retvalue = '$_tmp'.$this->prefix_number; } #line 2087 "smarty_internal_templateparser.php" #line 363 "smarty_internal_templateparser.y" - function yy_r91(){if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('special_smarty_variable',$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);} else { + function yy_r91(){ if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('special_smarty_variable',$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);} else { $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor['var'] .')->value'.$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor['var'],"'"), null, true, false)->nocache;} } #line 2091 "smarty_internal_templateparser.php" #line 366 "smarty_internal_templateparser.y" @@ -2146,8 +2146,8 @@ static public $yy_action = array( function yy_r113(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2142 "smarty_internal_templateparser.php" #line 420 "smarty_internal_templateparser.y" - function yy_r114(){ if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('special_smarty_variable',$this->yystack[$this->yyidx + -1]->minor['index']).$this->yystack[$this->yyidx + 0]->minor;} else { - $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -1]->minor['index'].$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor['var'],"'"), null, true, false)->nocache;} } + function yy_r114(){ if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('special_smarty_variable',$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor;} else { + $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'].$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor['var'],"'"), null, true, false)->nocache;} } #line 2146 "smarty_internal_templateparser.php" #line 423 "smarty_internal_templateparser.y" function yy_r115(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }