mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
* support both error codes and messages in the second parameter to
PEAR::isError()
This commit is contained in:
parent
2063094acc
commit
e853217651
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user