- bugfix on assigning multidimensional arrays within templates

- corrected bugfix for truncate modifier
This commit is contained in:
Uwe.Tews
2010-07-08 18:30:03 +00:00
parent 396d7aa8a5
commit db38a0aaec
5 changed files with 52 additions and 29 deletions
@@ -806,6 +806,26 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
}
}
/**
* creates a loacal Smarty variable for array assihgments
*/
public function createLocalArrayVariable($tpl_var, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
{
if (!isset($this->tpl_vars[$tpl_var])) {
$tpl_var_inst = $this->getVariable($tpl_var, null, true, false);
if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {
$this->tpl_vars[$tpl_var] = new Smarty_variable(array(), $nocache, $scope);
} else {
$this->tpl_vars[$tpl_var] = clone $tpl_var_inst;
if ($scope != SMARTY_LOCAL_SCOPE) {
$this->tpl_vars[$tpl_var]->scope = $scope;
}
}
}
if (!(is_array($this->tpl_vars[$tpl_var]->value) || $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)) {
settype($this->tpl_vars[$tpl_var]->value, 'array');
}
}
/**
* wrapper for display
*/