diff options
author | Stig Bakken <ssb@php.net> | 2001-04-17 01:29:48 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2001-04-17 01:29:48 +0000 |
commit | 266cc59f06334bf956b2abfe70759c46ec6ebed5 (patch) | |
tree | 7a53df4261b8a17f80d62d36665f3a54c867b80a | |
parent | 457333c1fdd4be021f82477d1a2b8e98be760f78 (diff) | |
download | php-git-266cc59f06334bf956b2abfe70759c46ec6ebed5.tar.gz |
* enable static use of PEAR::raiseError
-rw-r--r-- | pear/PEAR.php.in | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/pear/PEAR.php.in b/pear/PEAR.php.in index 490add5deb..529cd3dc3f 100644 --- a/pear/PEAR.php.in +++ b/pear/PEAR.php.in @@ -260,10 +260,11 @@ class PEAR */ function &raiseError($message = null, $code = null, $mode = null, - $options = null, $userinfo = null) + $options = null, $userinfo = null, + $error_class = null) { if ($mode === null) { - if (isset($this->_default_error_mode)) { + if (isset($this) && isset($this->_default_error_mode)) { $mode = $this->_default_error_mode; } else { $mode = $GLOBALS['_PEAR_default_error_mode']; @@ -271,7 +272,7 @@ class PEAR } if ($mode == PEAR_ERROR_TRIGGER && $options === null) { - if (isset($this->_default_error_options)) { + if (isset($this) && isset($this->_default_error_options)) { $options = $this->_default_error_options; } else { $options = $GLOBALS['_PEAR_default_error_options']; @@ -282,7 +283,7 @@ class PEAR if (!is_string($options) && !(is_array($options) && sizeof($options) == 2 && is_object($options[0]) && is_string($options[1]))) { - if (isset($this->_default_error_callback)) { + if (isset($this) && isset($this->_default_error_callback)) { $options = $this->_default_error_callback; } else { $options = $GLOBALS['_PEAR_default_error_callback']; @@ -290,14 +291,20 @@ class PEAR } } else { if ($options === null) { - if (isset($this->_default_error_options)) { + if (isset($this) && isset($this->_default_error_options)) { $options = $this->_default_error_options; } else { $options = $GLOBALS['_PEAR_default_error_options']; } } } - $ec = $this->_error_class; + if ($error_class !== null) { + $ec = $error_class; + } elseif (isset($this)) { + $ec = $this->_error_class; + } else { + $ec = 'PEAR_Error'; + } return new $ec($message, $code, $mode, $options, $userinfo); } |