define('PEAR_ERROR_TRIGGER', 4);
define('PEAR_ERROR_DIE', 8);
define('PEAR_ERROR_CALLBACK', 16);
+/**
+ * WARNING: obsolete
+ * @deprecated
+ */
define('PEAR_ERROR_EXCEPTION', 32);
define('PEAR_ZE2', (function_exists('version_compare') &&
version_compare(zend_version(), "2-dev", "ge")));
}
switch ($mode) {
+ case PEAR_ERROR_EXCEPTION:
case PEAR_ERROR_RETURN:
case PEAR_ERROR_PRINT:
case PEAR_ERROR_TRIGGER:
case PEAR_ERROR_DIE:
- case PEAR_ERROR_EXCEPTION:
case null:
$setmode = $mode;
$setoptions = $options;
$code = null,
$userinfo = null)
{
- if (isset($this) && is_subclass_of($this, 'PEAR_Error')) {
+ if (isset($this) && is_a($this, 'PEAR')) {
return $this->raiseError($message, $code, null, null, $userinfo);
} else {
return PEAR::raiseError($message, $code, null, null, $userinfo);
call_user_func($this->callback, $this);
}
}
- if (PEAR_ZE2 && $this->mode & PEAR_ERROR_EXCEPTION) {
- eval('throw $this;');
+ if ($this->mode & PEAR_ERROR_EXCEPTION) {
+ trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING);
+ eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);');
}
}
* Bug #534 pear search doesn't list unstable releases
* Bug #933 CMD Usability Patch
+ * Bug #937 throwError() treats every call as static
+ * Bug #964 PEAR_ERROR_EXCEPTION causes fatal error
* Bug #1008 safe mode raises warning
PEAR_ErrorStack: