cvs: php-src /pear PEAR.php
| From: | Greg Beaver | Date: | Sat, 03 Apr 2004 06:28:25 +0000 |
| Subject: | cvs: php-src /pear PEAR.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-211@lists.php.net to get a copy of this message | ||
cellog Sat Apr 3 01:28:25 2004 EDT
Modified files:
/php-src/pear PEAR.php
Log:
fix Bug #937 throwError() treats every call as static
fix Bug #964 PEAR_ERROR_EXCEPTION causes fatal error
http://cvs.php.net/diff.php/php-src/pear/PEAR.php?r1=1.79&r2=1.80&ty=u
Index: php-src/pear/PEAR.php
diff -u php-src/pear/PEAR.php:1.79 php-src/pear/PEAR.php:1.80
--- php-src/pear/PEAR.php:1.79 Sun Mar 21 17:11:18 2004
+++ php-src/pear/PEAR.php Sat Apr 3 01:28:13 2004
@@ -18,7 +18,7 @@
// | Tomas V.V.Cox <cox@idecnet.com> |
// +--------------------------------------------------------------------+
//
-// $Id: PEAR.php,v 1.79 2004/03/21 22:11:18 ssb Exp $
+// $Id: PEAR.php,v 1.80 2004/04/03 06:28:13 cellog Exp $
//
define('PEAR_ERROR_RETURN', 1);
@@ -26,6 +26,10 @@
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 @@
}
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 @@
$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 @@
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);');
}
}