]> granicus.if.org Git - php/commitdiff
* support both error codes and messages in the second parameter to
authorStig Bakken <ssb@php.net>
Thu, 3 Apr 2003 23:10:11 +0000 (23:10 +0000)
committerStig Bakken <ssb@php.net>
Thu, 3 Apr 2003 23:10:11 +0000 (23:10 +0000)
  PEAR::isError()

pear/PEAR.php

index a1d518ddd7f28e3099be91b8c43b3cd9cc2c9a95..8c536d717c1a07c12ba80387a5258bc77288c97a 100644 (file)
@@ -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;
     }