summaryrefslogtreecommitdiff
path: root/pear/PEAR.php
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2003-04-03 23:10:11 +0000
committerStig Bakken <ssb@php.net>2003-04-03 23:10:11 +0000
commite8532176511570d628e53289ab8aeb79d5ff4b12 (patch)
treecf95cd3d5785f4ecb7a9682c1b401bf825d053e8 /pear/PEAR.php
parent2063094acc4108e6985dcb4eae43b496d48cbc91 (diff)
downloadphp-git-e8532176511570d628e53289ab8aeb79d5ff4b12.tar.gz
* support both error codes and messages in the second parameter to
PEAR::isError()
Diffstat (limited to 'pear/PEAR.php')
-rw-r--r--pear/PEAR.php8
1 files changed, 7 insertions, 1 deletions
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;
}