summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2004-04-03 06:28:54 +0000
committerGreg Beaver <cellog@php.net>2004-04-03 06:28:54 +0000
commitb79e803a4327d30f114e7eb097bd39b1c89de32a (patch)
treeb9ef420ec24225bce1a99edb511ae7cbe86310a5 /pear
parent9d86149b012549462f2da89cabdd9b1b438bd24c (diff)
downloadphp-git-b79e803a4327d30f114e7eb097bd39b1c89de32a.tar.gz
fix Bug #937 throwError() treats every call as static
fix Bug #964 PEAR_ERROR_EXCEPTION causes fatal error
Diffstat (limited to 'pear')
-rw-r--r--pear/PEAR.php13
-rw-r--r--pear/package-PEAR.xml2
2 files changed, 11 insertions, 4 deletions
diff --git a/pear/PEAR.php b/pear/PEAR.php
index 7645d9717f..39089f6844 100644
--- a/pear/PEAR.php
+++ b/pear/PEAR.php
@@ -26,6 +26,10 @@ define('PEAR_ERROR_PRINT', 2);
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")));
@@ -306,11 +310,11 @@ class PEAR
}
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;
@@ -549,7 +553,7 @@ class PEAR
$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);
@@ -774,8 +778,9 @@ class PEAR_Error
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);');
}
}
diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml
index 0d809d6c90..c0aabb1fd8 100644
--- a/pear/package-PEAR.xml
+++ b/pear/package-PEAR.xml
@@ -55,6 +55,8 @@ PEAR Installer:
* 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: