From 997990a744650ae8dd029072559f37b3ea7d5f70 Mon Sep 17 00:00:00 2001 From: mohrt Date: Mon, 8 Jul 2002 14:58:51 +0000 Subject: [PATCH] cast var as an array, simplify and get rid of PHP warning messages --- Smarty.class.php | 8 ++------ libs/Smarty.class.php | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Smarty.class.php b/Smarty.class.php index 5bdfd0eb..db86dab9 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -247,16 +247,12 @@ class Smarty if (is_array($tpl_var)) { foreach ($tpl_var as $key => $val) { if (!empty($key)) { - if (!is_array($this->_tpl_vars[$key])) - settype($this->_tpl_vars[$key], 'array'); - $this->_tpl_vars[$key][] = $val; + (array)$this->_tpl_vars[$key][] = $val; } } } else { if (!empty($tpl_var) && isset($value)) { - if (!is_array($this->_tpl_vars[$tpl_var])) - settype($this->_tpl_vars[$tpl_var], 'array'); - $this->_tpl_vars[$tpl_var][] = $value; + (array)$this->_tpl_vars[$tpl_var][] = $value; } } $this->_extract = true; diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 5bdfd0eb..db86dab9 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -247,16 +247,12 @@ class Smarty if (is_array($tpl_var)) { foreach ($tpl_var as $key => $val) { if (!empty($key)) { - if (!is_array($this->_tpl_vars[$key])) - settype($this->_tpl_vars[$key], 'array'); - $this->_tpl_vars[$key][] = $val; + (array)$this->_tpl_vars[$key][] = $val; } } } else { if (!empty($tpl_var) && isset($value)) { - if (!is_array($this->_tpl_vars[$tpl_var])) - settype($this->_tpl_vars[$tpl_var], 'array'); - $this->_tpl_vars[$tpl_var][] = $value; + (array)$this->_tpl_vars[$tpl_var][] = $value; } } $this->_extract = true;