* support both error codes and messages in the second parameter to

PEAR::isError()
This commit is contained in:
Stig Bakken 2003-04-03 23:10:11 +00:00
parent 2063094acc
commit e853217651

View 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;
}