diff --git a/NEWS b/NEWS index 50a6b19a..03a16e3e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - add get_registered_object function (messju, Monte) - treat unrecognized param attribute syntax as string (Monte) - support $smarty.const.$foo syntax (messju, Monte) - remove E_NOTICE warnings from debug.tpl, diff --git a/Smarty.class.php b/Smarty.class.php index 00016eef..aef32a5b 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -1323,11 +1323,13 @@ class Smarty * @param string $name */ function &get_registered_object($name) { - if(isset($this->_reg_objects[$name])) { - return $this->_reg_objects[$name][0]; - } else { - return false; - } + if (!isset($this->_reg_objects[$object])) + $this->_trigger_fatal_error("'$object' is not a registered object"); + + if (!is_object($this->_reg_objects[$object][0])) + $this->_trigger_fatal_error("registered '$object' is not an object"); + + return $this->_reg_objects[$name][0]; } /**#@+ diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 00016eef..aef32a5b 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1323,11 +1323,13 @@ class Smarty * @param string $name */ function &get_registered_object($name) { - if(isset($this->_reg_objects[$name])) { - return $this->_reg_objects[$name][0]; - } else { - return false; - } + if (!isset($this->_reg_objects[$object])) + $this->_trigger_fatal_error("'$object' is not a registered object"); + + if (!is_object($this->_reg_objects[$object][0])) + $this->_trigger_fatal_error("registered '$object' is not an object"); + + return $this->_reg_objects[$name][0]; } /**#@+