diff --git a/Zend/tests/readonly_props/readonly_clone_error6.phpt b/Zend/tests/readonly_props/readonly_clone_error6.phpt index 16a04d802a11..ba63fecbb041 100644 --- a/Zend/tests/readonly_props/readonly_clone_error6.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error6.phpt @@ -22,13 +22,13 @@ var_dump($foo); try { $foo->__clone(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $foo->__clone(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); @@ -39,8 +39,8 @@ object(Foo)#%d (%d) { ["bar"]=> int(0) } -Cannot modify readonly property Foo::$bar -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar object(Foo)#%d (%d) { ["bar"]=> int(0) diff --git a/Zend/tests/readonly_props/readonly_clone_error7.phpt b/Zend/tests/readonly_props/readonly_clone_error7.phpt index e34ad9eb3d71..c653966dfc0a 100644 --- a/Zend/tests/readonly_props/readonly_clone_error7.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error7.phpt @@ -19,15 +19,15 @@ $foo = new Foo([]); try { var_dump(clone $foo); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(clone $foo); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$bar -Cannot indirectly modify readonly property Foo::$bar +Error: Cannot indirectly modify readonly property Foo::$bar +Error: Cannot indirectly modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/readonly_clone_success4.phpt b/Zend/tests/readonly_props/readonly_clone_success4.phpt index 40b7a29e3126..fea00e537046 100644 --- a/Zend/tests/readonly_props/readonly_clone_success4.phpt +++ b/Zend/tests/readonly_props/readonly_clone_success4.phpt @@ -13,7 +13,7 @@ class Foo { try { $this->bar = "foo"; } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $this->bar = 2; @@ -27,12 +27,12 @@ var_dump(clone $foo); ?> --EXPECTF-- -Cannot assign string to property Foo::$bar of type int +TypeError: Cannot assign string to property Foo::$bar of type int object(Foo)#%d (%d) { ["bar"]=> int(2) } -Cannot assign string to property Foo::$bar of type int +TypeError: Cannot assign string to property Foo::$bar of type int object(Foo)#%d (%d) { ["bar"]=> int(2) diff --git a/Zend/tests/readonly_props/readonly_coercion_type_error.phpt b/Zend/tests/readonly_props/readonly_coercion_type_error.phpt index d41211d8e998..ffe8411a2240 100644 --- a/Zend/tests/readonly_props/readonly_coercion_type_error.phpt +++ b/Zend/tests/readonly_props/readonly_coercion_type_error.phpt @@ -11,7 +11,7 @@ class Foo { try { $this->bar = 42; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -20,4 +20,4 @@ new Foo(); ?> --EXPECTF-- -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/readonly_containing_object.phpt b/Zend/tests/readonly_props/readonly_containing_object.phpt index 996b0ee3d44b..30b43619ecea 100644 --- a/Zend/tests/readonly_props/readonly_containing_object.phpt +++ b/Zend/tests/readonly_props/readonly_containing_object.phpt @@ -18,17 +18,17 @@ $test->prop->foo++; try { $test->prop += 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { --$test->prop; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop); @@ -44,9 +44,9 @@ var_dump($test->prop); ?> --EXPECT-- -Unsupported operand types: stdClass + int -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop +TypeError: Unsupported operand types: stdClass + int +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop object(stdClass)#2 (1) { ["foo"]=> int(3) diff --git a/Zend/tests/readonly_props/readonly_modification.phpt b/Zend/tests/readonly_props/readonly_modification.phpt index bd04a203be19..6d23fd1eecc8 100644 --- a/Zend/tests/readonly_props/readonly_modification.phpt +++ b/Zend/tests/readonly_props/readonly_modification.phpt @@ -21,62 +21,62 @@ var_dump($test->prop); // Read. try { $test->prop = 2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop += 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ++$test->prop; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ref =& $test->prop; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop =& $ref; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { byRef($test->prop); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop2); // Read. try { $test->prop2[] = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2[0][] = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(1) -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop -Cannot indirectly modify readonly property Test::$prop -Cannot indirectly modify readonly property Test::$prop -Cannot indirectly modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot indirectly modify readonly property Test::$prop +Error: Cannot indirectly modify readonly property Test::$prop +Error: Cannot indirectly modify readonly property Test::$prop array(0) { } -Cannot indirectly modify readonly property Test::$prop2 -Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 diff --git a/Zend/tests/readonly_props/unset.phpt b/Zend/tests/readonly_props/unset.phpt index 823c021f6122..e1b4e06ec6f1 100644 --- a/Zend/tests/readonly_props/unset.phpt +++ b/Zend/tests/readonly_props/unset.phpt @@ -15,7 +15,7 @@ $test = new Test(1); try { unset($test->prop); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test2 { @@ -40,7 +40,7 @@ var_dump($test->prop); // Don't call __get. try { unset($test->prop); // Unset initialized, illegal. } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test3 { @@ -51,7 +51,7 @@ $test = new Test3; try { unset($test->prop); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test4 { @@ -81,12 +81,12 @@ var_dump($test->prop); // Still don't call __get. ?> --EXPECT-- -Cannot unset readonly property Test::$prop +Error: Cannot unset readonly property Test::$prop Test2::__get int(1) int(1) -Cannot unset readonly property Test2::$prop -Cannot unset protected(set) readonly property Test3::$prop from global scope +Error: Cannot unset readonly property Test2::$prop +Error: Cannot unset protected(set) readonly property Test3::$prop from global scope Error: Cannot unset readonly property Test4::$prop int(1) Error: Cannot unset readonly property Test4::$prop diff --git a/Zend/tests/readonly_props/visibility_change.phpt b/Zend/tests/readonly_props/visibility_change.phpt index f4a32f3cdaaf..aeeaa5de2b73 100644 --- a/Zend/tests/readonly_props/visibility_change.phpt +++ b/Zend/tests/readonly_props/visibility_change.phpt @@ -18,7 +18,7 @@ $a = new A(); try { var_dump($a->prop); } catch (Error $error) { - echo $error->getMessage() . "\n"; + echo $error::class, ': ', $error->getMessage(), "\n"; } $b = new B(); @@ -26,5 +26,5 @@ var_dump($b->prop); ?> --EXPECT-- -Cannot access protected property A::$prop +Error: Cannot access protected property A::$prop int(42) diff --git a/Zend/tests/recursive_array_comparison.phpt b/Zend/tests/recursive_array_comparison.phpt index 53cc9736030d..0a89f820f4f3 100644 --- a/Zend/tests/recursive_array_comparison.phpt +++ b/Zend/tests/recursive_array_comparison.phpt @@ -6,16 +6,16 @@ $a = [&$a]; try { $a === [[]]; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { [[]] === $a; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a === $a); ?> --EXPECT-- -Nesting level too deep - recursive dependency? -Nesting level too deep - recursive dependency? +Error: Nesting level too deep - recursive dependency? +Error: Nesting level too deep - recursive dependency? bool(true) diff --git a/Zend/tests/recv_init_ref_type.phpt b/Zend/tests/recv_init_ref_type.phpt index 29b96d379f8d..343281249ba4 100644 --- a/Zend/tests/recv_init_ref_type.phpt +++ b/Zend/tests/recv_init_ref_type.phpt @@ -10,9 +10,9 @@ try { $bar = 42; test($bar); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d +TypeError: test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d diff --git a/Zend/tests/require_once_warning_to_exception.phpt b/Zend/tests/require_once_warning_to_exception.phpt index bc706622438f..bf51df8e8e45 100644 --- a/Zend/tests/require_once_warning_to_exception.phpt +++ b/Zend/tests/require_once_warning_to_exception.phpt @@ -11,9 +11,9 @@ set_error_handler("exception_error_handler"); try { $results = require_once 'does-not-exist.php'; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; }; ?> --EXPECT-- -require_once(): Failed to open stream: No such file or directory +Exception: require_once(): Failed to open stream: No such file or directory diff --git a/Zend/tests/require_parse_exception.phpt b/Zend/tests/require_parse_exception.phpt index d64efe178671..2c6556e38b79 100644 --- a/Zend/tests/require_parse_exception.phpt +++ b/Zend/tests/require_parse_exception.phpt @@ -9,7 +9,7 @@ function test_parse_error($code) { try { require 'data://text/plain;base64,' . base64_encode($code); } catch (ParseError $e) { - echo $e->getMessage(), " on line ", $e->getLine(), "\n"; + echo $e::class, ': ', $e->getMessage(), ' on line ', $e->getLine(), "\n"; } } @@ -43,9 +43,9 @@ var_dump("\u{ffffff}");'); ?> --EXPECT-- Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 -Unclosed '{' on line 2 -Unclosed '{' on line 3 -syntax error, unexpected end of file, expecting "(" on line 2 -Invalid numeric literal on line 2 -Invalid UTF-8 codepoint escape sequence on line 2 -Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2 +ParseError: Unclosed '{' on line 2 +ParseError: Unclosed '{' on line 3 +ParseError: syntax error, unexpected end of file, expecting "(" on line 2 +ParseError: Invalid numeric literal on line 2 +ParseError: Invalid UTF-8 codepoint escape sequence on line 2 +ParseError: Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2 diff --git a/Zend/tests/required_param_after_optional_named_args.phpt b/Zend/tests/required_param_after_optional_named_args.phpt index 19060ab108b0..f73014cc3661 100644 --- a/Zend/tests/required_param_after_optional_named_args.phpt +++ b/Zend/tests/required_param_after_optional_named_args.phpt @@ -8,10 +8,10 @@ function test($a = 1, $b) { try { test(b: 2); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: test(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d -test(): Argument #1 ($a) not passed +ArgumentCountError: test(): Argument #1 ($a) not passed diff --git a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt index afb099b6812d..c1adf8749e38 100644 --- a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt +++ b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt @@ -7,17 +7,17 @@ function by_ref(&$ref) {} try { by_ref($GLOBALS); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { by_ref2($GLOBALS); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } function by_ref2(&$ref) {} ?> --EXPECT-- -by_ref(): Argument #1 ($ref) could not be passed by reference -by_ref2(): Argument #1 ($ref) could not be passed by reference +Error: by_ref(): Argument #1 ($ref) could not be passed by reference +Error: by_ref2(): Argument #1 ($ref) could not be passed by reference diff --git a/Zend/tests/return_types/028.phpt b/Zend/tests/return_types/028.phpt index 802dd7708dfe..ac000d5b3461 100644 --- a/Zend/tests/return_types/028.phpt +++ b/Zend/tests/return_types/028.phpt @@ -12,9 +12,9 @@ function foo(): stdClass { try { foo(); } catch (Error $e) { - echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(); + echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), ' on line ', $e->getLine(), "\n"; } ?> --EXPECTF-- -foo(): Return value must be of type stdClass, array returned in %s on line %d +TypeError: foo(): Return value must be of type stdClass, array returned in %s on line %d diff --git a/Zend/tests/return_types/bug70557.phpt b/Zend/tests/return_types/bug70557.phpt index 1795a2a26a79..5ce47d723b22 100644 --- a/Zend/tests/return_types/bug70557.phpt +++ b/Zend/tests/return_types/bug70557.phpt @@ -10,8 +10,8 @@ function getNumber() : int { try { getNumber(); } catch (TypeError $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(62) "getNumber(): Return value must be of type int, string returned" +TypeError: getNumber(): Return value must be of type int, string returned diff --git a/Zend/tests/return_types/never_disallowed5.phpt b/Zend/tests/return_types/never_disallowed5.phpt index 26887cd46833..a8df4ae61960 100644 --- a/Zend/tests/return_types/never_disallowed5.phpt +++ b/Zend/tests/return_types/never_disallowed5.phpt @@ -14,8 +14,8 @@ class Foo { try { Foo::bar(); } catch (TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Foo::bar(): never-returning method must not implicitly return +TypeError: Foo::bar(): never-returning method must not implicitly return diff --git a/Zend/tests/self_and.phpt b/Zend/tests/self_and.phpt index f3662c575c48..313b021497ea 100644 --- a/Zend/tests/self_and.phpt +++ b/Zend/tests/self_and.phpt @@ -16,7 +16,7 @@ try { $s1 &= 11; var_dump($s1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 &= 33; @@ -32,7 +32,7 @@ echo "Done\n"; ?> --EXPECTF-- int(18) -Unsupported operand types: string & int +TypeError: Unsupported operand types: string & int Warning: A non-numeric value encountered in %s on line %d int(33) diff --git a/Zend/tests/self_instanceof_outside_class.phpt b/Zend/tests/self_instanceof_outside_class.phpt index ecb593a6a580..564267883207 100644 --- a/Zend/tests/self_instanceof_outside_class.phpt +++ b/Zend/tests/self_instanceof_outside_class.phpt @@ -7,11 +7,11 @@ $fn = function() { try { new stdClass instanceof self; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } }; $fn(); ?> --EXPECT-- -Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active diff --git a/Zend/tests/self_method_or_prop_outside_class.phpt b/Zend/tests/self_method_or_prop_outside_class.phpt index feaeccf25f95..d77398f35341 100644 --- a/Zend/tests/self_method_or_prop_outside_class.phpt +++ b/Zend/tests/self_method_or_prop_outside_class.phpt @@ -8,29 +8,29 @@ $fn = function() { try { self::${$str . "bar"}; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset(self::${$str . "bar"}); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset(self::${$str . "bar"}); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { self::{$str . "bar"}(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } }; $fn(); ?> --EXPECT-- -Cannot access "self" when no class scope is active -Cannot access "self" when no class scope is active -Cannot access "self" when no class scope is active -Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active diff --git a/Zend/tests/self_mod.phpt b/Zend/tests/self_mod.phpt index 7d469f800239..0514d3b8d6d7 100644 --- a/Zend/tests/self_mod.phpt +++ b/Zend/tests/self_mod.phpt @@ -14,7 +14,7 @@ try { $s1 %= 11; var_dump($s1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 %= 33; @@ -24,7 +24,7 @@ echo "Done\n"; ?> --EXPECTF-- int(13) -Unsupported operand types: string % int +TypeError: Unsupported operand types: string % int Warning: A non-numeric value encountered in %s on line %d int(3) diff --git a/Zend/tests/self_or.phpt b/Zend/tests/self_or.phpt index 61f1f4203b08..1005a721ea9c 100644 --- a/Zend/tests/self_or.phpt +++ b/Zend/tests/self_or.phpt @@ -16,7 +16,7 @@ try { $s1 |= 11; var_dump($s1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 |= 33; @@ -32,7 +32,7 @@ echo "Done\n"; ?> --EXPECTF-- int(127) -Unsupported operand types: string | int +TypeError: Unsupported operand types: string | int Warning: A non-numeric value encountered in %s on line %d int(45345) diff --git a/Zend/tests/self_xor.phpt b/Zend/tests/self_xor.phpt index 4bff3f6d508e..d47d9e44d3cb 100644 --- a/Zend/tests/self_xor.phpt +++ b/Zend/tests/self_xor.phpt @@ -16,7 +16,7 @@ try { $s1 ^= 11; var_dump($s1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 ^= 33; @@ -32,7 +32,7 @@ echo "Done\n"; ?> --EXPECTF-- int(109) -Unsupported operand types: string ^ int +TypeError: Unsupported operand types: string ^ int Warning: A non-numeric value encountered in %s on line %d int(45312) diff --git a/Zend/tests/serialize/bug64354.phpt b/Zend/tests/serialize/bug64354.phpt index 11b0aa31e247..a7c40a1631e6 100644 --- a/Zend/tests/serialize/bug64354.phpt +++ b/Zend/tests/serialize/bug64354.phpt @@ -17,9 +17,9 @@ $data = array(new B); try { serialize($data); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: B implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d -string(9) "serialize" +Exception: serialize diff --git a/Zend/tests/serialize/bug71841.phpt b/Zend/tests/serialize/bug71841.phpt index f32b0e9b231f..c99e1ecc5091 100644 --- a/Zend/tests/serialize/bug71841.phpt +++ b/Zend/tests/serialize/bug71841.phpt @@ -6,40 +6,40 @@ $z = unserialize('O:1:"A":0:{}'); try { var_dump($z->e.=0); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(++$z->x); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($z->y++); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $y = array(PHP_INT_MAX => 0); try { var_dump($y[] .= 0); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(++$y[]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($y[]++); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition -The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition -The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied +Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition +Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition +Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/shift_001.phpt b/Zend/tests/shift_001.phpt index f441cf2dcf8b..e444ad7aa865 100644 --- a/Zend/tests/shift_001.phpt +++ b/Zend/tests/shift_001.phpt @@ -14,7 +14,7 @@ try { $s1 <<= 1; var_dump($s1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 <<= 3; @@ -24,7 +24,7 @@ echo "Done\n"; ?> --EXPECTF-- int(492) -Unsupported operand types: string << int +TypeError: Unsupported operand types: string << int Warning: A non-numeric value encountered in %s on line %d int(362760) diff --git a/Zend/tests/shift_002.phpt b/Zend/tests/shift_002.phpt index 0bdc9b3eeb3c..ba2bbb81bf7b 100644 --- a/Zend/tests/shift_002.phpt +++ b/Zend/tests/shift_002.phpt @@ -14,7 +14,7 @@ try { $s1 >>= 1; var_dump($s1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 >>= 3; @@ -24,7 +24,7 @@ echo "Done\n"; ?> --EXPECTF-- int(30) -Unsupported operand types: string >> int +TypeError: Unsupported operand types: string >> int Warning: A non-numeric value encountered in %s on line %d int(5668) diff --git a/Zend/tests/stack_limit/stack_limit_001.phpt b/Zend/tests/stack_limit/stack_limit_001.phpt index 73cc3c08fe9d..56f84e751a64 100644 --- a/Zend/tests/stack_limit/stack_limit_001.phpt +++ b/Zend/tests/stack_limit/stack_limit_001.phpt @@ -36,19 +36,19 @@ function replace() { try { new Test1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -63,6 +63,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_002.phpt b/Zend/tests/stack_limit/stack_limit_002.phpt index 64a11e1b2638..05d4c2dc03ed 100644 --- a/Zend/tests/stack_limit/stack_limit_002.phpt +++ b/Zend/tests/stack_limit/stack_limit_002.phpt @@ -35,19 +35,19 @@ $fiber = new Fiber(function (): void { try { new Test1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } }); @@ -65,6 +65,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_003.phpt b/Zend/tests/stack_limit/stack_limit_003.phpt index 9956c761cb18..97f9756970bf 100644 --- a/Zend/tests/stack_limit/stack_limit_003.phpt +++ b/Zend/tests/stack_limit/stack_limit_003.phpt @@ -34,19 +34,19 @@ function replace() { try { new Test1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -61,6 +61,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_006.phpt b/Zend/tests/stack_limit/stack_limit_006.phpt index d8d6251cf0c6..e97a1c2e0c5d 100644 --- a/Zend/tests/stack_limit/stack_limit_006.phpt +++ b/Zend/tests/stack_limit/stack_limit_006.phpt @@ -293,19 +293,19 @@ function replace() { try { new Test1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -320,6 +320,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_007.phpt b/Zend/tests/stack_limit/stack_limit_007.phpt index d34e244234c2..2c77eca61b2e 100644 --- a/Zend/tests/stack_limit/stack_limit_007.phpt +++ b/Zend/tests/stack_limit/stack_limit_007.phpt @@ -19,7 +19,7 @@ function replace() { $tryExecuted = true; return replace(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; // We should not enter the catch block if we haven't executed at // least one op in the try block printf("Try executed: %d\n", $tryExecuted ?? 0); @@ -41,5 +41,5 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? Try executed: 1 diff --git a/Zend/tests/stack_limit/stack_limit_008.phpt b/Zend/tests/stack_limit/stack_limit_008.phpt index db61fb15e52c..a059f92c4468 100644 --- a/Zend/tests/stack_limit/stack_limit_008.phpt +++ b/Zend/tests/stack_limit/stack_limit_008.phpt @@ -22,7 +22,7 @@ function replace() { try { return replace2(); } catch (Error $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } } }, 'x'); @@ -55,4 +55,4 @@ array(4) { string(%d) "0x%x" } Will throw: -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_011.phpt b/Zend/tests/stack_limit/stack_limit_011.phpt index 762f67184f6a..7d26a3269336 100644 --- a/Zend/tests/stack_limit/stack_limit_011.phpt +++ b/Zend/tests/stack_limit/stack_limit_011.phpt @@ -35,7 +35,7 @@ function replace() { try { replace(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; echo 'Previous: ', $e->getPrevious()->getMessage(), "\n"; } @@ -51,5 +51,5 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? Previous: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_014.phpt b/Zend/tests/stack_limit/stack_limit_014.phpt index 144c64ad39ea..84e80d62a2fd 100644 --- a/Zend/tests/stack_limit/stack_limit_014.phpt +++ b/Zend/tests/stack_limit/stack_limit_014.phpt @@ -16,7 +16,7 @@ memory_limit=1G try { require __DIR__.'/stack_limit_014.inc'; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/static_method_non_existing_class.phpt b/Zend/tests/static_method_non_existing_class.phpt index 752655d22782..424549394039 100644 --- a/Zend/tests/static_method_non_existing_class.phpt +++ b/Zend/tests/static_method_non_existing_class.phpt @@ -7,9 +7,9 @@ $str = "foo"; try { Test::{$str . "bar"}(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Class "Test" not found +Error: Class "Test" not found diff --git a/Zend/tests/static_variables/static_variables_destructor.phpt b/Zend/tests/static_variables/static_variables_destructor.phpt index 9128c86e6b1b..3d848f0bd5fb 100644 --- a/Zend/tests/static_variables/static_variables_destructor.phpt +++ b/Zend/tests/static_variables/static_variables_destructor.phpt @@ -25,12 +25,12 @@ function foo(bool $throw) { try { foo(true); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } foo(false); ?> --EXPECT-- bar() called -__destruct() called +Exception: __destruct() called int(42) diff --git a/Zend/tests/static_variables/static_variables_throwing_initializer.phpt b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt index 9e4752c24f5c..192df8c9a3e6 100644 --- a/Zend/tests/static_variables/static_variables_throwing_initializer.phpt +++ b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt @@ -11,11 +11,11 @@ function foo($throw) { try { var_dump(foo(true)); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(foo(false)); ?> --EXPECT-- -Throwing from foo() +Exception: Throwing from foo() int(42) diff --git a/Zend/tests/string_offset_as_object.phpt b/Zend/tests/string_offset_as_object.phpt index 6fdebe936088..8631bd82fd5b 100644 --- a/Zend/tests/string_offset_as_object.phpt +++ b/Zend/tests/string_offset_as_object.phpt @@ -7,57 +7,57 @@ $str = "x"; try { $str[0]->bar = "xyz"; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar[1] = "bang"; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar += 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar = &$b; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ++$str[0]->bar; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { --$str[0]->bar; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar--; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($str[0]->bar); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object diff --git a/Zend/tests/string_offset_errors.phpt b/Zend/tests/string_offset_errors.phpt index 726dc41f0653..cd1cc1fb4825 100644 --- a/Zend/tests/string_offset_errors.phpt +++ b/Zend/tests/string_offset_errors.phpt @@ -16,24 +16,24 @@ function &gen() { try { test(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str = "foo"; $str[0] =& $str[1]; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foreach (gen() as $v) {} } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create references to/from string offsets -Cannot create references to/from string offsets -Cannot create references to/from string offsets +Error: Cannot create references to/from string offsets +Error: Cannot create references to/from string offsets +Error: Cannot create references to/from string offsets diff --git a/Zend/tests/strlen_deprecation_to_exception.phpt b/Zend/tests/strlen_deprecation_to_exception.phpt index 7b616f3b6432..7a6dcf3699d3 100644 --- a/Zend/tests/strlen_deprecation_to_exception.phpt +++ b/Zend/tests/strlen_deprecation_to_exception.phpt @@ -9,9 +9,9 @@ set_error_handler(function($_, $msg) { try { strlen(null); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -strlen(): Passing null to parameter #1 ($string) of type string is deprecated +Exception: strlen(): Passing null to parameter #1 ($string) of type string is deprecated diff --git a/Zend/tests/strncasecmp_basic.phpt b/Zend/tests/strncasecmp_basic.phpt index 54eb6fb5209b..a2ac35e4ec72 100644 --- a/Zend/tests/strncasecmp_basic.phpt +++ b/Zend/tests/strncasecmp_basic.phpt @@ -6,7 +6,7 @@ strncasecmp() tests try { var_dump(strncasecmp("", "", -1)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(strncasecmp("aef", "dfsgbdf", 0)); @@ -19,7 +19,7 @@ var_dump(strncasecmp("01", "01", 1000)); ?> --EXPECT-- -strncasecmp(): Argument #3 ($length) must be greater than or equal to 0 +ValueError: strncasecmp(): Argument #3 ($length) must be greater than or equal to 0 int(0) int(-3) int(0) diff --git a/Zend/tests/strncmp_basic.phpt b/Zend/tests/strncmp_basic.phpt index bb40946f240a..77be55179db1 100644 --- a/Zend/tests/strncmp_basic.phpt +++ b/Zend/tests/strncmp_basic.phpt @@ -7,7 +7,7 @@ var_dump(strncmp("", "", 100)); try { var_dump(strncmp("aef", "dfsgbdf", -1)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(strncmp("fghjkl", "qwer", 0)); var_dump(strncmp("qwerty", "qwerty123", 6)); @@ -16,7 +16,7 @@ var_dump(strncmp("qwerty", "qwerty123", 7)); ?> --EXPECT-- int(0) -strncmp(): Argument #3 ($length) must be greater than or equal to 0 +ValueError: strncmp(): Argument #3 ($length) must be greater than or equal to 0 int(0) int(0) int(-1) diff --git a/Zend/tests/sub_001.phpt b/Zend/tests/sub_001.phpt index 92e3ff0021f0..66e268d65b62 100644 --- a/Zend/tests/sub_001.phpt +++ b/Zend/tests/sub_001.phpt @@ -9,7 +9,7 @@ $b = array(1); try { var_dump($a - $b); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $a - $b; @@ -18,7 +18,7 @@ var_dump($c); echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: array - array +TypeError: Unsupported operand types: array - array Fatal error: Uncaught TypeError: Unsupported operand types: array - array in %s:%d Stack trace: diff --git a/Zend/tests/switch/bug80046.phpt b/Zend/tests/switch/bug80046.phpt index 87a493c20308..45adb6e9726f 100644 --- a/Zend/tests/switch/bug80046.phpt +++ b/Zend/tests/switch/bug80046.phpt @@ -14,9 +14,9 @@ function test($foo) { try { test('Foo'); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Default +Exception: Default diff --git a/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt b/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt index 95d2fc1233d4..d93dd64077da 100644 --- a/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt +++ b/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt @@ -12,9 +12,9 @@ class Foo { try { Foo::test(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Access to undeclared static property Foo::$property +Error: Access to undeclared static property Foo::$property diff --git a/Zend/tests/this-reserved/this_in_extract.phpt b/Zend/tests/this-reserved/this_in_extract.phpt index 2e3f7b497fdb..3157f35ac4e1 100644 --- a/Zend/tests/this-reserved/this_in_extract.phpt +++ b/Zend/tests/this-reserved/this_in_extract.phpt @@ -6,14 +6,14 @@ function foo() { try { extract(["this"=>42, "a"=>24]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a); } foo(); ?> --EXPECTF-- -Cannot re-assign $this +Error: Cannot re-assign $this Warning: Undefined variable $a in %s on line %d NULL diff --git a/Zend/tests/throw/001.phpt b/Zend/tests/throw/001.phpt index ba2406c6d388..91d30d717440 100644 --- a/Zend/tests/throw/001.phpt +++ b/Zend/tests/throw/001.phpt @@ -7,84 +7,84 @@ try { $result = true && throw new Exception("true && throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false && throw new Exception("false && throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true and throw new Exception("true and throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false and throw new Exception("false and throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true || throw new Exception("true || throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false || throw new Exception("false || throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true or throw new Exception("true or throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false or throw new Exception("false or throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = null ?? throw new Exception("null ?? throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = "foo" ?? throw new Exception('"foo" ?? throw'); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = null ?: throw new Exception("null ?: throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = "foo" ?: throw new Exception('"foo" ?: throw'); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -92,7 +92,7 @@ try { var_dump("not yet"); $callable(); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } $result = "bar"; @@ -107,27 +107,27 @@ try { throw new Exception("exception 2") ); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true ? true : throw new Exception("true ? true : throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false ? true : throw new Exception("false ? true : throw"); var_dump($result); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw new Exception() + 1; } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -144,30 +144,30 @@ var_dump($exception->getMessage()); try { throw null ?? new Exception('throw null ?? new Exception();'); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(13) "true && throw" +Exception: true && throw bool(false) -string(14) "true and throw" +Exception: true and throw bool(false) bool(true) -string(14) "false || throw" +Exception: false || throw bool(true) -string(14) "false or throw" -string(13) "null ?? throw" +Exception: false or throw +Exception: null ?? throw string(3) "foo" -string(13) "null ?: throw" +Exception: null ?: throw string(3) "foo" string(7) "not yet" -string(13) "fn() => throw" +Exception: fn() => throw string(3) "bar" -string(11) "exception 1" +Exception: exception 1 bool(true) -string(20) "false ? true : throw" -string(42) "Unsupported operand types: Exception + int" +Exception: false ? true : throw +TypeError: Unsupported operand types: Exception + int string(35) "throw $exception = new Exception();" string(37) "throw $exception ??= new Exception();" -string(30) "throw null ?? new Exception();" +Exception: throw null ?? new Exception(); diff --git a/Zend/tests/throw/002.phpt b/Zend/tests/throw/002.phpt index e80dfbb7d14d..a904c09f6080 100644 --- a/Zend/tests/throw/002.phpt +++ b/Zend/tests/throw/002.phpt @@ -24,25 +24,25 @@ class Foo { try { (new Foo())->throwException(); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Foo::staticThrowException(); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw true ? new Exception('Ternary true 1') : new Exception('Ternary true 2'); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw false ? new Exception('Ternary false 1') : new Exception('Ternary false 2'); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -50,7 +50,7 @@ try { $exception2 = new Exception('Coalesce non-null 2'); throw $exception1 ?? $exception2; } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -58,27 +58,27 @@ try { $exception2 = new Exception('Coalesce null 2'); throw $exception1 ?? $exception2; } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw $exception = new Exception('Assignment'); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $exception = null; throw $exception ??= new Exception('Coalesce assignment null'); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $exception = new Exception('Coalesce assignment non-null 1'); throw $exception ??= new Exception('Coalesce assignment non-null 2'); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $andConditionalTest = function ($condition1, $condition2) { @@ -90,39 +90,39 @@ $andConditionalTest = function ($condition1, $condition2) { try { $andConditionalTest(false, false); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $andConditionalTest(false, true); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $andConditionalTest(true, false); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $andConditionalTest(true, true); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not found -Static not found -Ternary true 1 -Ternary false 2 -Coalesce non-null 1 -Coalesce null 2 -Assignment -Coalesce assignment null -Coalesce assignment non-null 1 -And in conditional 2 -And in conditional 2 -And in conditional 2 -And in conditional 1 +Exception: Not found +Exception: Static not found +Exception: Ternary true 1 +Exception: Ternary false 2 +Exception: Coalesce non-null 1 +Exception: Coalesce null 2 +Exception: Assignment +Exception: Coalesce assignment null +Exception: Coalesce assignment non-null 1 +Exception: And in conditional 2 +Exception: And in conditional 2 +Exception: And in conditional 2 +Exception: And in conditional 1 diff --git a/Zend/tests/throwing_overloaded_compound_assign_op.phpt b/Zend/tests/throwing_overloaded_compound_assign_op.phpt index 39c38627076c..2f50984734b3 100644 --- a/Zend/tests/throwing_overloaded_compound_assign_op.phpt +++ b/Zend/tests/throwing_overloaded_compound_assign_op.phpt @@ -16,7 +16,7 @@ $test[0] = 42; try { $test[0] %= 0; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); @@ -24,13 +24,13 @@ $test2 = new Test; try { $test2->prop %= 0; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test2); ?> --EXPECT-- -Modulo by zero +DivisionByZeroError: Modulo by zero object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { @@ -38,7 +38,7 @@ object(ArrayObject)#1 (1) { int(42) } } -Modulo by zero +DivisionByZeroError: Modulo by zero object(Test)#3 (1) { ["prop"]=> int(42) diff --git a/Zend/tests/traits/gh_17728.phpt b/Zend/tests/traits/gh_17728.phpt index ef458a8e8d5e..7107091db14d 100644 --- a/Zend/tests/traits/gh_17728.phpt +++ b/Zend/tests/traits/gh_17728.phpt @@ -16,9 +16,9 @@ trait Foo { try { Foo::bar(); } catch (ErrorException $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait +ErrorException: Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait diff --git a/Zend/tests/traits/trait_type_errors.phpt b/Zend/tests/traits/trait_type_errors.phpt index d3c7c0582fb1..f9cf86305579 100644 --- a/Zend/tests/traits/trait_type_errors.phpt +++ b/Zend/tests/traits/trait_type_errors.phpt @@ -23,21 +23,21 @@ $c = new C; try { $c->test1("foo"); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $c->test2("foo"); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $c->test3("foo"); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -C::test1(): Return value must be of type int, string returned -C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d -C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d +TypeError: C::test1(): Return value must be of type int, string returned +TypeError: C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d +TypeError: C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d diff --git a/Zend/tests/trigger_error_basic.phpt b/Zend/tests/trigger_error_basic.phpt index d492590bcd92..ec0ea3f7af83 100644 --- a/Zend/tests/trigger_error_basic.phpt +++ b/Zend/tests/trigger_error_basic.phpt @@ -8,12 +8,12 @@ var_dump(trigger_error("error")); try { var_dump(trigger_error("error", -1)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(trigger_error("error", 0)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(trigger_error("error", E_USER_WARNING)); @@ -23,8 +23,8 @@ var_dump(trigger_error("error", E_USER_DEPRECATED)); --EXPECTF-- Notice: error in %s on line %d bool(true) -trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED -trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED +ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED +ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED Warning: error in %s on line %d bool(true) diff --git a/Zend/tests/try/bug70228_3.phpt b/Zend/tests/try/bug70228_3.phpt index 55dbe4f8914a..0f02d2a6def7 100644 --- a/Zend/tests/try/bug70228_3.phpt +++ b/Zend/tests/try/bug70228_3.phpt @@ -21,11 +21,11 @@ try { var_dump(test()); } catch (Exception $e) { do { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; $e = $e->getPrevious(); } while ($e); } ?> --EXPECT-- -2 -1 +Exception: 2 +Exception: 1 diff --git a/Zend/tests/try/bug70228_4.phpt b/Zend/tests/try/bug70228_4.phpt index f0ab3b0c2c11..8d2e3e0717bd 100644 --- a/Zend/tests/try/bug70228_4.phpt +++ b/Zend/tests/try/bug70228_4.phpt @@ -23,10 +23,10 @@ try { var_dump(test()); } catch (Exception $e) { do { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; $e = $e->getPrevious(); } while ($e); } ?> --EXPECT-- -1 +Exception: 1 diff --git a/Zend/tests/try/bug70228_5.phpt b/Zend/tests/try/bug70228_5.phpt index 29cbf4910de1..e1bbf959d465 100644 --- a/Zend/tests/try/bug70228_5.phpt +++ b/Zend/tests/try/bug70228_5.phpt @@ -13,8 +13,8 @@ function test() { try { test(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ops +Exception: ops diff --git a/Zend/tests/try/bug72213.phpt b/Zend/tests/try/bug72213.phpt index 50555f53e419..493e9db15d59 100644 --- a/Zend/tests/try/bug72213.phpt +++ b/Zend/tests/try/bug72213.phpt @@ -16,10 +16,10 @@ function test() { try { test(); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->getPrevious()->getMessage()); } ?> --EXPECT-- -string(1) "b" +Exception: b string(1) "a" diff --git a/Zend/tests/try/bug72213_2.phpt b/Zend/tests/try/bug72213_2.phpt index a9b5f1490b2d..eca2e5e8e135 100644 --- a/Zend/tests/try/bug72213_2.phpt +++ b/Zend/tests/try/bug72213_2.phpt @@ -19,8 +19,8 @@ function test() { try { test(); } catch (Exception $e) { - echo "caught {$e->getMessage()}\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -caught 1 +Exception: 1 diff --git a/Zend/tests/try/catch_finally_006.phpt b/Zend/tests/try/catch_finally_006.phpt index 216219b6a5b3..6f4027721bf8 100644 --- a/Zend/tests/try/catch_finally_006.phpt +++ b/Zend/tests/try/catch_finally_006.phpt @@ -19,7 +19,7 @@ try { var_dump(foo("para")); } catch (Exception $e) { "caught exception" . PHP_EOL; - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/try/try_finally_002.phpt b/Zend/tests/try/try_finally_002.phpt index 99a34f62fbd7..3c595f7a11ac 100644 --- a/Zend/tests/try/try_finally_002.phpt +++ b/Zend/tests/try/try_finally_002.phpt @@ -14,10 +14,10 @@ try { foo(); } catch (Exception $e) { do { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } while ($e = $e->getPrevious()); } ?> --EXPECT-- -string(7) "finally" -string(3) "try" +Exception: finally +Exception: try diff --git a/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt b/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt index 3f720ba2b47f..d63fff22ed68 100644 --- a/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt +++ b/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt @@ -12,9 +12,9 @@ set_error_handler(function($_, $msg) { try { test(0.5); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Implicit conversion from float 0.5 to int loses precision +Exception: Implicit conversion from float 0.5 to int loses precision diff --git a/Zend/tests/type_coercion/gh22112.phpt b/Zend/tests/type_coercion/gh22112.phpt index 84fdc393a828..d7629960da5e 100644 --- a/Zend/tests/type_coercion/gh22112.phpt +++ b/Zend/tests/type_coercion/gh22112.phpt @@ -20,16 +20,16 @@ $nan = fdiv(0, 0); try { take_bool($nan); } catch (Exception $e) { - echo "bool: ", $e->getMessage(), "\n"; + echo 'bool: ', $e::class, ': ', $e->getMessage(), "\n"; } try { take_string($nan); } catch (Exception $e) { - echo "string: ", $e->getMessage(), "\n"; + echo 'string: ', $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bool: unexpected NAN value was coerced to bool -string: unexpected NAN value was coerced to string +bool: Exception: unexpected NAN value was coerced to bool +string: Exception: unexpected NAN value was coerced to string diff --git a/Zend/tests/type_coercion/settype/settype_resource.phpt b/Zend/tests/type_coercion/settype/settype_resource.phpt index fa9ca739fa90..aeadc3d4c0f5 100644 --- a/Zend/tests/type_coercion/settype/settype_resource.phpt +++ b/Zend/tests/type_coercion/settype/settype_resource.phpt @@ -33,7 +33,7 @@ foreach ($vars as $var) { try { settype($var, "resource"); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump($var); } @@ -41,22 +41,22 @@ foreach ($vars as $var) { echo "Done\n"; ?> --EXPECTF-- -Cannot convert to resource type +ValueError: Cannot convert to resource type string(6) "string" -Cannot convert to resource type +ValueError: Cannot convert to resource type string(7) "8754456" -Cannot convert to resource type +ValueError: Cannot convert to resource type string(0) "" -Cannot convert to resource type +ValueError: Cannot convert to resource type string(1) "%0" -Cannot convert to resource type +ValueError: Cannot convert to resource type int(9876545) -Cannot convert to resource type +ValueError: Cannot convert to resource type float(0.1) -Cannot convert to resource type +ValueError: Cannot convert to resource type array(0) { } -Cannot convert to resource type +ValueError: Cannot convert to resource type array(3) { [0]=> int(1) @@ -65,15 +65,15 @@ array(3) { [2]=> int(3) } -Cannot convert to resource type +ValueError: Cannot convert to resource type bool(false) -Cannot convert to resource type +ValueError: Cannot convert to resource type bool(true) -Cannot convert to resource type +ValueError: Cannot convert to resource type NULL -Cannot convert to resource type +ValueError: Cannot convert to resource type resource(%d) of type (stream) -Cannot convert to resource type +ValueError: Cannot convert to resource type object(test)#%d (0) { } Done diff --git a/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt b/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt index 17921e5ae530..73fea49fb208 100644 --- a/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt +++ b/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt @@ -18,4 +18,4 @@ var_dump($nan); --EXPECT-- float(NAN) unexpected NAN value was coerced to string -string(3) "NAN" \ No newline at end of file +string(3) "NAN" diff --git a/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt b/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt index 26911bddb7eb..24243badbcbf 100644 --- a/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt +++ b/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt @@ -8,11 +8,11 @@ try { (void) somefunc(); }); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && function () { +AssertionError: assert(false && function () { (void)somefunc(); }) diff --git a/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt b/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt index 6375c60ab71b..21c76ecb6cd6 100644 --- a/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt +++ b/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt @@ -41,12 +41,12 @@ var_dump($o); try { bar1(); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bar2(); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -59,5 +59,5 @@ object(B)#%d (0) { } object(B)#%d (0) { } -bar1(): Return value must be of type (X&Y)|(W&Z), C returned -bar2(): Return value must be of type (W&Z)|(X&Y), C returned +TypeError: bar1(): Return value must be of type (X&Y)|(W&Z), C returned +TypeError: bar2(): Return value must be of type (W&Z)|(X&Y), C returned diff --git a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt index e9089c130b49..6aa9f831c60e 100644 --- a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt +++ b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt @@ -40,22 +40,22 @@ $c = new C(); try { $test->foo1($c); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->foo2($c); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop1 = $c; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = $c; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -67,8 +67,8 @@ object(A)#2 (0) { } NULL NULL -Test::foo1(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d -Test::foo2(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d -Cannot assign C to property Test::$prop1 of type (X&Y)|null -Cannot assign C to property Test::$prop2 of type (X&Y)|null +TypeError: Test::foo1(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d +TypeError: Test::foo2(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d +TypeError: Cannot assign C to property Test::$prop1 of type (X&Y)|null +TypeError: Cannot assign C to property Test::$prop2 of type (X&Y)|null ===DONE=== diff --git a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt index 4c9a5f95e30d..3451909ef808 100644 --- a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt +++ b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt @@ -61,42 +61,42 @@ $c = new C(); try { $test->foo1($c); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->foo2($c); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->bar1($c); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->bar2($c); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop1 = $c; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = $c; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop3 = $c; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop4 = $c; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -116,12 +116,12 @@ object(B)#3 (0) { } object(B)#3 (0) { } -Test::foo1(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d -Test::foo2(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d -Test::bar1(): Argument #1 ($v) must be of type B|(X&Y), C given, called in %s on line %d -Test::bar2(): Argument #1 ($v) must be of type (X&Y)|B, C given, called in %s on line %d -Cannot assign C to property Test::$prop1 of type (X&Y)|int -Cannot assign C to property Test::$prop2 of type (X&Y)|int -Cannot assign C to property Test::$prop3 of type (X&Y)|B -Cannot assign C to property Test::$prop4 of type B|(X&Y) +TypeError: Test::foo1(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d +TypeError: Test::foo2(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d +TypeError: Test::bar1(): Argument #1 ($v) must be of type B|(X&Y), C given, called in %s on line %d +TypeError: Test::bar2(): Argument #1 ($v) must be of type (X&Y)|B, C given, called in %s on line %d +TypeError: Cannot assign C to property Test::$prop1 of type (X&Y)|int +TypeError: Cannot assign C to property Test::$prop2 of type (X&Y)|int +TypeError: Cannot assign C to property Test::$prop3 of type (X&Y)|B +TypeError: Cannot assign C to property Test::$prop4 of type B|(X&Y) ===DONE=== diff --git a/Zend/tests/type_declarations/dnf_types/gh9516.phpt b/Zend/tests/type_declarations/dnf_types/gh9516.phpt index 3d91932ebd45..db400d2535c7 100644 --- a/Zend/tests/type_declarations/dnf_types/gh9516.phpt +++ b/Zend/tests/type_declarations/dnf_types/gh9516.phpt @@ -25,28 +25,28 @@ try { $t->method1(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method1(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method1(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method1(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } // Lets try in reverse? @@ -54,28 +54,28 @@ try { $t->method2(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method2(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method2(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method2(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } /* Single before intersection */ @@ -83,28 +83,28 @@ try { $t->method3(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method3(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method3(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method3(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } // Lets try in reverse? @@ -112,46 +112,46 @@ try { $t->method4(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method4(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method4(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method4(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } ?> --EXPECTF-- -T::method1(): Argument #1 ($arg) must be of type (A&B)|D, A_ given, called in %s on line %d -T::method1(): Argument #1 ($arg) must be of type (A&B)|D, B_ given, called in %s on line %d +TypeError: T::method1(): Argument #1 ($arg) must be of type (A&B)|D, A_ given, called in %s on line %d +TypeError: T::method1(): Argument #1 ($arg) must be of type (A&B)|D, B_ given, called in %s on line %d Pass Pass -T::method2(): Argument #1 ($arg) must be of type (B&A)|D, A_ given, called in %s on line %d -T::method2(): Argument #1 ($arg) must be of type (B&A)|D, B_ given, called in %s on line %d +TypeError: T::method2(): Argument #1 ($arg) must be of type (B&A)|D, A_ given, called in %s on line %d +TypeError: T::method2(): Argument #1 ($arg) must be of type (B&A)|D, B_ given, called in %s on line %d Pass Pass -T::method3(): Argument #1 ($arg) must be of type D|(A&B), A_ given, called in %s on line %d -T::method3(): Argument #1 ($arg) must be of type D|(A&B), B_ given, called in %s on line %d +TypeError: T::method3(): Argument #1 ($arg) must be of type D|(A&B), A_ given, called in %s on line %d +TypeError: T::method3(): Argument #1 ($arg) must be of type D|(A&B), B_ given, called in %s on line %d Pass Pass -T::method4(): Argument #1 ($arg) must be of type D|(B&A), A_ given, called in %s on line %d -T::method4(): Argument #1 ($arg) must be of type D|(B&A), B_ given, called in %s on line %d +TypeError: T::method4(): Argument #1 ($arg) must be of type D|(B&A), A_ given, called in %s on line %d +TypeError: T::method4(): Argument #1 ($arg) must be of type D|(B&A), B_ given, called in %s on line %d Pass Pass diff --git a/Zend/tests/type_declarations/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt index 5b2ad90abfea..3235a3bb2a13 100644 --- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt +++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt @@ -8,28 +8,28 @@ echo "*** Trying Ord With Integer" . PHP_EOL; try { var_dump(ord(1)); } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "*** Trying Array Map With Invalid Callback" . PHP_EOL; try { array_map([null, "bar"], []); } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "*** Trying Strlen With Float" . PHP_EOL; try { var_dump(strlen(1.5)); } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- *** Trying Ord With Integer -*** Caught ord(): Argument #1 ($character) must be of type string, int given +TypeError: ord(): Argument #1 ($character) must be of type string, int given *** Trying Array Map With Invalid Callback -*** Caught array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object *** Trying Strlen With Float -*** Caught strlen(): Argument #1 ($string) must be of type string, float given +TypeError: strlen(): Argument #1 ($string) must be of type string, float given diff --git a/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt b/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt index 568e6e25afad..d81d1fb392b5 100644 --- a/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt +++ b/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt @@ -29,7 +29,7 @@ $o = new A(); try { $o->prop = $tp; } catch (TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } $o->prop = $tc; @@ -46,7 +46,7 @@ var_dump($r); ?> --EXPECTF-- -Cannot assign TestParent to property A::$prop of type X&Y&Z +TypeError: Cannot assign TestParent to property A::$prop of type X&Y&Z object(TestChild)#%d (0) { } object(TestParent)#%d (0) { diff --git a/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt b/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt index 83af5e96ccfa..7a1a1c2aaed3 100644 --- a/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt +++ b/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt @@ -10,10 +10,10 @@ function foo(X&Y $foo = null) { try { foo(5); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: foo(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d -foo(): Argument #1 ($foo) must be of type (X&Y)|null, int given, called in %s on line %d +TypeError: foo(): Argument #1 ($foo) must be of type (X&Y)|null, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt b/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt index e724e1b15f50..15bbc4a69d19 100644 --- a/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt +++ b/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt @@ -25,7 +25,7 @@ try { $o = foo(); var_dump($o); } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = new Collection(); @@ -34,17 +34,17 @@ $a = new A(); try { $c->intersect = $a; } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bar($a); } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -foo(): Return value must be of type X&Y, A returned -Cannot assign A to property Collection::$intersect of type X&Y -bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d +TypeError: foo(): Return value must be of type X&Y, A returned +TypeError: Cannot assign A to property Collection::$intersect of type X&Y +TypeError: bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/parameter.phpt b/Zend/tests/type_declarations/intersection_types/parameter.phpt index d1c7de224365..316e50756e41 100644 --- a/Zend/tests/type_declarations/intersection_types/parameter.phpt +++ b/Zend/tests/type_declarations/intersection_types/parameter.phpt @@ -18,11 +18,11 @@ foo(new Foo()); try { foo(new Bar()); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- object(Foo)#1 (0) { } -foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d +TypeError: foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/typed_reference.phpt b/Zend/tests/type_declarations/intersection_types/typed_reference.phpt index 2ceb34f256ff..2ba3e2f4f9d3 100644 --- a/Zend/tests/type_declarations/intersection_types/typed_reference.phpt +++ b/Zend/tests/type_declarations/intersection_types/typed_reference.phpt @@ -22,9 +22,9 @@ $test->z =& $r; try { $r = new B; } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign B to reference held by property Test::$z of type X&Z +TypeError: Cannot assign B to reference held by property Test::$z of type X&Z diff --git a/Zend/tests/type_declarations/iterable/iterable_001.phpt b/Zend/tests/type_declarations/iterable/iterable_001.phpt index 7c127c8e1dfd..c264908fbb54 100644 --- a/Zend/tests/type_declarations/iterable/iterable_001.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_001.phpt @@ -20,7 +20,7 @@ test(new ArrayIterator([1, 2, 3])); try { test(1); } catch (Throwable $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -47,4 +47,4 @@ object(ArrayIterator)#1 (1) { int(3) } } -test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d +TypeError: test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/iterable/iterable_003.phpt b/Zend/tests/type_declarations/iterable/iterable_003.phpt index a2c96995da37..978f177fc4b4 100644 --- a/Zend/tests/type_declarations/iterable/iterable_003.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_003.phpt @@ -20,7 +20,7 @@ var_dump(bar()); try { baz(); } catch (Throwable $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -31,4 +31,4 @@ object(Generator)#%d (1) { ["function"]=> string(17) "{closure:bar():7}" } -baz(): Return value must be of type Traversable|array, int returned +TypeError: baz(): Return value must be of type Traversable|array, int returned diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt index 61900f993c0e..a511187aa2c6 100644 --- a/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt +++ b/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt @@ -8,21 +8,21 @@ function test(false $v) { var_dump($v); } try { test(0); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(''); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test([]); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -test(): Argument #1 ($v) must be of type false, int given, called in %s on line %d -test(): Argument #1 ($v) must be of type false, string given, called in %s on line %d -test(): Argument #1 ($v) must be of type false, array given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type false, int given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type false, string given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type false, array given, called in %s on line %d diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt index 726245705ffc..4cab7f0ad274 100644 --- a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt +++ b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt @@ -22,10 +22,10 @@ var_dump($p->foo(0)); try { var_dump($c->foo(0)); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(false) -C::foo(): Return value must be of type array|false, int returned +TypeError: C::foo(): Return value must be of type array|false, int returned diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt index 85d6c90cd057..379012708499 100644 --- a/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt +++ b/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt @@ -8,27 +8,27 @@ function test(true $v) { var_dump($v); } try { test(1); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test('1'); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test([1]); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(new stdClass()); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d -test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d -test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d -test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt index 7eebe1e3571f..0acf7e3646a9 100644 --- a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt +++ b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt @@ -22,10 +22,10 @@ var_dump($p->foo(1)); try { var_dump($c->foo(1)); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -C::foo(): Return value must be of type array|true, int returned +TypeError: C::foo(): Return value must be of type array|true, int returned diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt index 8a2c60002054..b77d9ca8e168 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt @@ -28,9 +28,9 @@ $foo = new Foo(); try { $foo->property1; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Typed property Foo::$property1 must not be accessed before initialization +Error: Typed property Foo::$property1 must not be accessed before initialization diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt index e83023d54cf2..b633cfb4a8cc 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt @@ -27,9 +27,9 @@ $foo = new Foo(); try { $foo->property1; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Typed property Foo::$property1 must not be accessed before initialization +Error: Typed property Foo::$property1 must not be accessed before initialization diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt index 2bd775af0a47..52bbfc2d67e3 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt @@ -11,9 +11,9 @@ function foo(): mixed try { foo(); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -foo(): Return value must be of type mixed, none returned +TypeError: foo(): Return value must be of type mixed, none returned diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt index 52bd99beb6cd..f1eb0a131852 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt @@ -10,9 +10,9 @@ function foo(): mixed try { foo(); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -foo(): Return value must be of type mixed, none returned +TypeError: foo(): Return value must be of type mixed, none returned diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt index 352c48f8a9e0..6f92e5e8695d 100644 --- a/Zend/tests/type_declarations/scalar_basic.phpt +++ b/Zend/tests/type_declarations/scalar_basic.phpt @@ -53,7 +53,7 @@ foreach ($functions as $type => $function) { try { var_dump($function($value)); } catch (\TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -76,19 +76,19 @@ E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line int(1) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying int(%d) int(%d) *** Trying float(NAN) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) int(1) @@ -97,22 +97,22 @@ int(1) int(0) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -129,13 +129,13 @@ float(1) float(1.5) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying int(%d) float(%s) @@ -150,22 +150,22 @@ float(1) float(0) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: @@ -204,22 +204,22 @@ string(1) "1" string(0) "" *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } string(6) "foobar" *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: @@ -258,21 +258,21 @@ bool(true) bool(false) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt index 5e3826de7dcb..eed7ed58b228 100644 --- a/Zend/tests/type_declarations/scalar_constant_defaults.phpt +++ b/Zend/tests/type_declarations/scalar_constant_defaults.phpt @@ -65,14 +65,14 @@ echo "Testing int with default null constant" . PHP_EOL; try { var_dump(int_val_default_null()); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Testing int with null null constant" . PHP_EOL; try { var_dump(int_val_default_null(null)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Testing nullable int with default null constant" . PHP_EOL; @@ -96,9 +96,9 @@ float(10.7) Testing string add val string(14) "this is a test" Testing int with default null constant -int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d +TypeError: int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d Testing int with null null constant -int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d +TypeError: int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d Testing nullable int with default null constant NULL Testing nullable int with null null constant