cast var as an array, simplify and get rid of PHP warning messages

This commit is contained in:
mohrt
2002-07-08 14:58:51 +00:00
parent a512243eb6
commit 997990a744
2 changed files with 4 additions and 12 deletions

View File

@@ -247,16 +247,12 @@ class Smarty
if (is_array($tpl_var)) { if (is_array($tpl_var)) {
foreach ($tpl_var as $key => $val) { foreach ($tpl_var as $key => $val) {
if (!empty($key)) { if (!empty($key)) {
if (!is_array($this->_tpl_vars[$key])) (array)$this->_tpl_vars[$key][] = $val;
settype($this->_tpl_vars[$key], 'array');
$this->_tpl_vars[$key][] = $val;
} }
} }
} else { } else {
if (!empty($tpl_var) && isset($value)) { if (!empty($tpl_var) && isset($value)) {
if (!is_array($this->_tpl_vars[$tpl_var])) (array)$this->_tpl_vars[$tpl_var][] = $value;
settype($this->_tpl_vars[$tpl_var], 'array');
$this->_tpl_vars[$tpl_var][] = $value;
} }
} }
$this->_extract = true; $this->_extract = true;

View File

@@ -247,16 +247,12 @@ class Smarty
if (is_array($tpl_var)) { if (is_array($tpl_var)) {
foreach ($tpl_var as $key => $val) { foreach ($tpl_var as $key => $val) {
if (!empty($key)) { if (!empty($key)) {
if (!is_array($this->_tpl_vars[$key])) (array)$this->_tpl_vars[$key][] = $val;
settype($this->_tpl_vars[$key], 'array');
$this->_tpl_vars[$key][] = $val;
} }
} }
} else { } else {
if (!empty($tpl_var) && isset($value)) { if (!empty($tpl_var) && isset($value)) {
if (!is_array($this->_tpl_vars[$tpl_var])) (array)$this->_tpl_vars[$tpl_var][] = $value;
settype($this->_tpl_vars[$tpl_var], 'array');
$this->_tpl_vars[$tpl_var][] = $value;
} }
} }
$this->_extract = true; $this->_extract = true;