cvs: php4 /pear PEAR.php
| From: | Stig Bakken | Date: | Thu, 03 Apr 2003 23:10:10 +0000 |
| Subject: | cvs: php4 /pear PEAR.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-9725@lists.php.net to get a copy of this message | ||
ssb Thu Apr 3 18:10:10 2003 EDT
Modified files:
/php4/pear PEAR.php
Log:
* support both error codes and messages in the second parameter to
PEAR::isError()
Index: php4/pear/PEAR.php
diff -u php4/pear/PEAR.php:1.58 php4/pear/PEAR.php:1.59
--- php4/pear/PEAR.php:1.58 Tue Mar 18 07:06:05 2003
+++ php4/pear/PEAR.php Thu Apr 3 18:10:10 2003
@@ -18,7 +18,7 @@
// | Tomas V.V.Cox <cox@idecnet.com> |
// +----------------------------------------------------------------------+
//
-// $Id: PEAR.php,v 1.58 2003/03/18 12:06:05 ssb Exp $
+// $Id: PEAR.php,v 1.59 2003/04/03 23:10:10 ssb Exp $
//
define('PEAR_ERROR_RETURN', 1);
@@ -232,7 +232,13 @@
{
if (is_object($data) && (get_class($data) == 'pear_error' ||
is_subclass_of($data, 'pear_error'))) {
- return $code === null ? true : $data->getCode() == $code;
+ if (is_null($code)) {
+ return true;
+ } elseif (is_string($code)) {
+ return $data->getMessage() == $code;
+ } else {
+ return $data->getCode() == $code;
+ }
}
return false;
}