summaryrefslogtreecommitdiff
path: root/pear/PEAR.php
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2001-11-04 09:07:17 +0000
committerStig Bakken <ssb@php.net>2001-11-04 09:07:17 +0000
commitdb44b1086cbb06be1d3e1390d43cf6b1fecb1bf5 (patch)
tree31865f7ee1026e2ed634c134144836a4dde91ea7 /pear/PEAR.php
parentc4b7501956cb79d729e56115a7ef17bbe8f89c22 (diff)
downloadphp-git-db44b1086cbb06be1d3e1390d43cf6b1fecb1bf5.tar.gz
* expectError() now accepts "*" as a catch-all
* updated tests
Diffstat (limited to 'pear/PEAR.php')
-rw-r--r--pear/PEAR.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/pear/PEAR.php b/pear/PEAR.php
index 1f73c0c1e2..4a6a19d6ee 100644
--- a/pear/PEAR.php
+++ b/pear/PEAR.php
@@ -286,7 +286,7 @@ class PEAR
*
* @return int the new depth of the "expected errors" stack
*/
- function expectError($code)
+ function expectError($code = "*")
{
if (is_array($code)) {
array_push($this->_expected_errors, $code);
@@ -366,8 +366,12 @@ class PEAR
$message = $message->getMessage();
}
- if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && in_array($code, end($this->_expected_errors))) {
- $mode = PEAR_ERROR_RETURN;
+ if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
+ if ($exp[0] == "*" ||
+ (is_int(reset($exp)) && in_array($code, $exp)) ||
+ (is_string(reset($exp)) && in_array($message, $exp))) {
+ $mode = PEAR_ERROR_RETURN;
+ }
}
if ($mode === null) {