From: Stig Bakken Date: Thu, 3 Apr 2003 23:10:11 +0000 (+0000) Subject: * support both error codes and messages in the second parameter to X-Git-Tag: RELEASE_0_5~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8532176511570d628e53289ab8aeb79d5ff4b12;p=php * support both error codes and messages in the second parameter to PEAR::isError() --- diff --git a/pear/PEAR.php b/pear/PEAR.php index a1d518ddd7..8c536d717c 100644 --- a/pear/PEAR.php +++ b/pear/PEAR.php @@ -232,7 +232,13 @@ class PEAR { 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; }