mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
- bugfix on object as array index
This commit is contained in:
@@ -24,7 +24,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
|
|||||||
{
|
{
|
||||||
$this->compiler = $compiler;
|
$this->compiler = $compiler;
|
||||||
$this->required_attributes = array('var', 'value');
|
$this->required_attributes = array('var', 'value');
|
||||||
$this->optional_attributes = array('scope', 'nocache', 'index');
|
$this->optional_attributes = array('scope', 'nocache', 'smarty_internal_index');
|
||||||
|
|
||||||
$_nocache = 'null';
|
$_nocache = 'null';
|
||||||
$_scope = 'null';
|
$_scope = 'null';
|
||||||
@@ -49,16 +49,12 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
|
|||||||
$_scope = SMARTY_GLOBAL_SCOPE;
|
$_scope = SMARTY_GLOBAL_SCOPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_attr['index'])) {
|
|
||||||
$_index = $_attr['index'];
|
|
||||||
}
|
|
||||||
// compiled output
|
// compiled output
|
||||||
if (isset($_attr['index'])) {
|
if (isset($_attr['smarty_internal_index'])) {
|
||||||
if ($_attr['index'] == '') {
|
if ($_attr['smarty_internal_index'] == '') {
|
||||||
return "<?php \$_smarty_tpl->append($_attr[var],$_attr[value],false,$_nocache,$_scope);?>";
|
return "<?php \$_smarty_tpl->append($_attr[var],$_attr[value],false,$_nocache,$_scope);?>";
|
||||||
} else {
|
} else {
|
||||||
return "<?php \$_tmp$_attr[index] = $_attr[value]; \$_smarty_tpl->append($_attr[var],\$_tmp,true,$_nocache,$_scope); unset (\$_tmp);?>";
|
return "<?php \$_tmp$_attr[smarty_internal_index] = $_attr[value]; \$_smarty_tpl->append($_attr[var],\$_tmp,true,$_nocache,$_scope); unset (\$_tmp);?>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return "<?php \$_smarty_tpl->assign($_attr[var],$_attr[value],$_nocache,$_scope);?>";
|
return "<?php \$_smarty_tpl->assign($_attr[var],$_attr[value],$_nocache,$_scope);?>";
|
||||||
|
@@ -2091,7 +2091,7 @@ static public $yy_action = array(
|
|||||||
function yy_r90(){ $this->prefix_number++; $this->compiler->prefix_code[] = '<?php ob_start();?>'.$this->yystack[$this->yyidx + 0]->minor.'<?php $_tmp'.$this->prefix_number.'=ob_get_clean();?>'; $this->_retvalue = '$_tmp'.$this->prefix_number; }
|
function yy_r90(){ $this->prefix_number++; $this->compiler->prefix_code[] = '<?php ob_start();?>'.$this->yystack[$this->yyidx + 0]->minor.'<?php $_tmp'.$this->prefix_number.'=ob_get_clean();?>'; $this->_retvalue = '$_tmp'.$this->prefix_number; }
|
||||||
#line 2087 "smarty_internal_templateparser.php"
|
#line 2087 "smarty_internal_templateparser.php"
|
||||||
#line 363 "smarty_internal_templateparser.y"
|
#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;} }
|
$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 2091 "smarty_internal_templateparser.php"
|
||||||
#line 366 "smarty_internal_templateparser.y"
|
#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.')'; }
|
function yy_r113(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; }
|
||||||
#line 2142 "smarty_internal_templateparser.php"
|
#line 2142 "smarty_internal_templateparser.php"
|
||||||
#line 420 "smarty_internal_templateparser.y"
|
#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 {
|
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['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;} }
|
$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 2146 "smarty_internal_templateparser.php"
|
||||||
#line 423 "smarty_internal_templateparser.y"
|
#line 423 "smarty_internal_templateparser.y"
|
||||||
function yy_r115(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
|
function yy_r115(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
|
||||||
|
Reference in New Issue
Block a user