Changed AssertionException to AssertionError

This commit is contained in:
Aaron Piotrowski 2015-06-14 23:52:39 -05:00
parent 4d590ac35a
commit 482985ca38
13 changed files with 21 additions and 21 deletions

View File

@ -9,7 +9,7 @@ assert(false);
var_dump(true);
?>
--EXPECTF--
Fatal error: Uncaught AssertionException: assert(false) in %sexpect_002.php:%d
Fatal error: Uncaught AssertionError: assert(false) in %sexpect_002.php:%d
Stack trace:
#0 %sexpect_002.php(%d): assert(false, 'assert(false)')
#1 {main}

View File

@ -7,7 +7,7 @@ assert.exception=1
<?php
try {
assert(false);
} catch (AssertionException $ex) {
} catch (AssertionError $ex) {
var_dump($ex->getMessage());
}
?>

View File

@ -7,7 +7,7 @@ assert.exception=1
<?php
try {
assert(false, "I require this to succeed");
} catch (AssertionException $ex) {
} catch (AssertionError $ex) {
var_dump($ex->getMessage());
}
?>

View File

@ -8,7 +8,7 @@ assert.exception=1
try {
/* by passing we test there are no leaks upon success */
assert(true, "I require this to succeed");
} catch (AssertionException $ex) {
} catch (AssertionError $ex) {
var_dump($ex->getMessage());
}
var_dump(true);

View File

@ -11,12 +11,12 @@ $data = array(
"value" => "testing"
);
class HeaderMalfunctionException extends AssertionException {}
class HeaderMalfunctionError extends AssertionError {}
assert (preg_match("~^([a-zA-Z0-9-]+)$~", $data["key"]), new HeaderMalfunctionException("malformed key found at {$next} \"{$data["key"]}\""));
assert (preg_match("~^([a-zA-Z0-9-]+)$~", $data["key"]), new HeaderMalfunctionError("malformed key found at {$next} \"{$data["key"]}\""));
?>
--EXPECTF--
Fatal error: Uncaught HeaderMalfunctionException: malformed key found at 1 "X-HTTP " in %sexpect_007.php:10
Fatal error: Uncaught HeaderMalfunctionError: malformed key found at 1 "X-HTTP " in %sexpect_007.php:10
Stack trace:
#0 {main}
thrown in %sexpect_007.php on line 10

View File

@ -12,7 +12,7 @@ class One {
}
class Two extends One {}
class OdEar extends AssertionException {}
class OdEar extends AssertionError {}
function blah(){ return 1; }

View File

@ -17,7 +17,7 @@ class Two extends One {
new Two();
?>
--EXPECTF--
Fatal error: Uncaught AssertionException: assert(false) in %sexpect_009.php:%d
Fatal error: Uncaught AssertionError: assert(false) in %sexpect_009.php:%d
Stack trace:
#0 %sexpect_009.php(%d): assert(false, 'assert(false)')
#1 %sexpect_009.php(%d): Two->__construct()

View File

@ -15,7 +15,7 @@ class Two extends One {}
new Two();
?>
--EXPECTF--
Fatal error: Uncaught AssertionException: assert(false) in %sexpect_010.php:%d
Fatal error: Uncaught AssertionError: assert(false) in %sexpect_010.php:%d
Stack trace:
#0 %sexpect_010.php(%d): assert(false, 'assert(false)')
#1 %sexpect_010.php(%d): One->__construct()

View File

@ -5,7 +5,7 @@ zend.assertions=1
assert.exception=1
--FILE--
<?php
class MyExpectations extends AssertionException {
class MyExpectations extends AssertionError {
public function __toString() {
return sprintf(
"[Message]: %s", __CLASS__);
@ -22,7 +22,7 @@ class Two extends One {}
new Two();
?>
--EXPECTF--
Fatal error: Uncaught AssertionException: [Message]: MyExpectations in %sexpect_011.php:%d
Fatal error: Uncaught AssertionError: [Message]: MyExpectations in %sexpect_011.php:%d
Stack trace:
#0 %sexpect_011.php(%d): assert(false, '[Message]: MyEx...')
#1 %sexpect_011.php(%d): One->__construct()

View File

@ -13,7 +13,7 @@ assert(false);
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught AssertionException: assert(false) in %sexception_011.php:%d
Fatal error: Uncaught AssertionError: assert(false) in %sexception_011.php:%d
Stack trace:
#0 %sexception_011.php(%d): assert(false, 'assert(false)')
#1 {main}

View File

@ -13,7 +13,7 @@ $func();
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught AssertionException: assert(false) in %sexception_012.php(%d) : runtime-created function:%d
Fatal error: Uncaught AssertionError: assert(false) in %sexception_012.php(%d) : runtime-created function:%d
Stack trace:
#0 %sexception_012.php(%d) : runtime-created function(%d): assert(false, 'assert(false)')
#1 %sexception_012.php(%d): __lambda_func()

View File

@ -17,6 +17,6 @@ array(4) {
[2]=>
%s(9) "Directory"
[3]=>
%s(18) "AssertionException"
%s(14) "AssertionError"
}
==DONE==

View File

@ -37,7 +37,7 @@ ZEND_END_MODULE_GLOBALS(assert)
ZEND_DECLARE_MODULE_GLOBALS(assert)
static zend_class_entry *assertion_exception_ce;
static zend_class_entry *assertion_error_ce;
#ifdef ZTS
#define ASSERTG(v) ZEND_TSRMG(assert_globals_id, zend_assert_globals *, v)
@ -113,8 +113,8 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */
REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT);
INIT_CLASS_ENTRY(ce, "AssertionException", NULL);
assertion_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default());
INIT_CLASS_ENTRY(ce, "AssertionError", NULL);
assertion_error_ce = zend_register_internal_class_ex(&ce, zend_get_error());
return SUCCESS;
}
@ -244,14 +244,14 @@ PHP_FUNCTION(assert)
if (ASSERTG(exception)) {
if (!description) {
zend_throw_exception(assertion_exception_ce, NULL, E_ERROR);
zend_throw_exception(assertion_error_ce, NULL, E_ERROR);
} else if (Z_TYPE_P(description) == IS_OBJECT &&
instanceof_function(Z_OBJCE_P(description), assertion_exception_ce)) {
instanceof_function(Z_OBJCE_P(description), assertion_error_ce)) {
Z_ADDREF_P(description);
zend_throw_exception_object(description);
} else {
zend_string *str = zval_get_string(description);
zend_throw_exception(assertion_exception_ce, str->val, E_ERROR);
zend_throw_exception(assertion_error_ce, str->val, E_ERROR);
zend_string_release(str);
}
} else if (ASSERTG(warning)) {