From 54a0c0e6768064cbd396197ced9b1654d189c915 Mon Sep 17 00:00:00 2001 From: mohrt Date: Mon, 17 Feb 2003 18:03:00 +0000 Subject: [PATCH] add error msgs to get_registered_object --- NEWS | 1 + Smarty.class.php | 12 +++++++----- libs/Smarty.class.php | 12 +++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) 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]; } /**#@+