fix for PEAR bug #964, check before commit
| From: | Greg Beaver | Date: | Fri, 19 Mar 2004 03:26:25 +0000 |
| Subject: | fix for PEAR bug #964, check before commit | ||
| Groups: | php.pear.core | ||
| Request: | Send a blank email to pear-core+get-193@lists.php.net to get a copy of this message | ||
Hi all,
I want to double check this patch before I commit it. Basically, it removes PEAR_ERROR_EXCEPTION without killing user uses of it, and removes documentation on it.
Greg
Index: pear/PEAR.php
===================================================================
RCS file: /repository/php-src/pear/PEAR.php,v
retrieving revision 1.50.2.17
diff -u -r1.50.2.17 PEAR.php
--- pear/PEAR.php 27 Feb 2004 02:27:12 -0000 1.50.2.17 +++ pear/PEAR.php 19 Mar 2004 03:23:04 -0000@@ -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")));@@ -266,7 +270,7 @@
* @param int $mode
* One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
* PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
+ * PEAR_ERROR_CALLBACK.
*
* @param mixed $options
* When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
@@ -290,7 +294,6 @@
* @see PEAR_ERROR_TRIGGER
* @see PEAR_ERROR_DIE
* @see PEAR_ERROR_CALLBACK
- * @see PEAR_ERROR_EXCEPTION
*
* @since PHP 4.0.5
*/
@@ -306,11 +309,13 @@
}
switch ($mode) {
+ case PEAR_ERROR_EXCEPTION:
+ $setmode = PEAR_ERROR_DIE;
+ trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING);
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;
@@ -460,7 +465,7 @@
*
* @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
* PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
+ * PEAR_ERROR_CALLBACK.
*
* @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
* specifies the PHP-internal error level (one of
@@ -712,7 +717,7 @@
*
* @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN,
* PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
+ * PEAR_ERROR_CALLBACK
*
* @param mixed $options (optional) error level, _OR_ in the case of
* PEAR_ERROR_CALLBACK, the callback function or object/method
@@ -774,9 +779,6 @@
call_user_func($this->callback, $this);
}
}
- if (PEAR_ZE2 && $this->mode & PEAR_ERROR_EXCEPTION) {
- eval('throw $this;');
- }
}
// }}}