From: Stig Bakken Date: Sat, 10 Mar 2001 09:59:15 +0000 (+0000) Subject: * only register the destructor if it exists X-Git-Tag: php-4.0.5RC1~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=adc498e70566b75c3b8df561f270debca74c3928;p=php * only register the destructor if it exists --- diff --git a/pear/PEAR.php.in b/pear/PEAR.php.in index 354d244d57..9ff0e54619 100644 --- a/pear/PEAR.php.in +++ b/pear/PEAR.php.in @@ -73,11 +73,14 @@ class PEAR /** * Constructor. Registers this object in - * $_PEAR_destructor_object_list for destructor emulation. + * $_PEAR_destructor_object_list for destructor emulation if a + * destructor object exists. */ function PEAR() { - global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; + if (method_exists($this, "_".get_class($this))) { + global $_PEAR_destructor_object_list; + $_PEAR_destructor_object_list[] = &$this; + } if ($this->_debug) { printf("PEAR constructor called, class=%s\n", get_class($this)); @@ -199,7 +202,30 @@ class PEAR // {{{ raiseError() /** - * This method is called by DB to generate an error. + * This method is a wrapper that returns an instance of PEAR_Error + * with this object's default error handling applied. If the + * $mode and $options parameters are not specified, the object's + * defaults are used. + * + * @param $message a text error message + * @param $code a numeric error code (it is up to your class + * to define these if you want to use codes) + * @param $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, + * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or + * PEAR_ERROR_CALLBACK. + * @param $options If $mode is PEAR_ERROR_TRIGGER, this parameter + * specifies the PHP-internal error level (one of + * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). + * If $mode is PEAR_ERROR_CALLBACK, this + * parameter specifies the callback function or + * method. In other error modes this parameter + * is ignored. + * @param $userinfo If you need to pass along for example debug + * information, this parameter is meant for that. + * + * @return object a PEAR error object + * + * @see PEAR::setErrorHandling * * @since PHP 4.0.5 */