diff --git a/Zend/tests/function_arguments/variadic_argument_type_error.phpt b/Zend/tests/function_arguments/variadic_argument_type_error.phpt index 9041aadcadfd..a7b06d363a77 100644 --- a/Zend/tests/function_arguments/variadic_argument_type_error.phpt +++ b/Zend/tests/function_arguments/variadic_argument_type_error.phpt @@ -8,16 +8,16 @@ function foo($foo, int ...$bar) {} try { foo(1, []); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { foo(1, 1, 1, []); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECTF-- -foo(): Argument #2 must be of type int, array given, called in %s on line %d -foo(): Argument #4 must be of type int, array given, called in %s on line %d +TypeError: foo(): Argument #2 must be of type int, array given, called in %s on line %d +TypeError: foo(): Argument #4 must be of type int, array given, called in %s on line %d diff --git a/Zend/tests/gc/bug54305.phpt b/Zend/tests/gc/bug54305.phpt index 61e351306f78..1cbb5fc2ef25 100644 --- a/Zend/tests/gc/bug54305.phpt +++ b/Zend/tests/gc/bug54305.phpt @@ -12,8 +12,8 @@ $methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs'); try { echo $methodWithArgs++; } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot increment ReflectionMethod +TypeError: Cannot increment ReflectionMethod diff --git a/Zend/tests/gc/bug80072.phpt b/Zend/tests/gc/bug80072.phpt index d7bf1956cf60..bbf1543ad5ed 100644 --- a/Zend/tests/gc/bug80072.phpt +++ b/Zend/tests/gc/bug80072.phpt @@ -7,11 +7,11 @@ try { $s = 'O:8:"stdClass":1:{s:1:"x";r:1;}'; unserialize($s) % gc_collect_cycles(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $a[]=&$a == $a=&$b > gc_collect_cycles(); ?> --EXPECT-- -Unsupported operand types: stdClass % int +TypeError: Unsupported operand types: stdClass % int diff --git a/Zend/tests/generators/bug79927.phpt b/Zend/tests/generators/bug79927.phpt index df8f245ddfde..dbebd77d70fc 100644 --- a/Zend/tests/generators/bug79927.phpt +++ b/Zend/tests/generators/bug79927.phpt @@ -12,7 +12,7 @@ $generator->next(); try { $generator->rewind(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $generator->current(), "\n"; @@ -26,6 +26,6 @@ echo $generator2->current(), "\n"; ?> --EXPECT-- -Cannot rewind a generator that was already run +Exception: Cannot rewind a generator that was already run 3 4 diff --git a/Zend/tests/generators/dynamic_properties.phpt b/Zend/tests/generators/dynamic_properties.phpt index 08ceb7f581c6..2e40239b0acc 100644 --- a/Zend/tests/generators/dynamic_properties.phpt +++ b/Zend/tests/generators/dynamic_properties.phpt @@ -11,9 +11,9 @@ $gen = gen(); try { $gen->prop = new stdClass; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property Generator::$prop +Error: Cannot create dynamic property Generator::$prop diff --git a/Zend/tests/generators/errors/count_error.phpt b/Zend/tests/generators/errors/count_error.phpt index 03ca1eed6032..3fa9bcf8856c 100644 --- a/Zend/tests/generators/errors/count_error.phpt +++ b/Zend/tests/generators/errors/count_error.phpt @@ -10,9 +10,9 @@ $gen = gen(); try { count($gen); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -count(): Argument #1 ($value) must be of type Countable|array, Generator given +TypeError: count(): Argument #1 ($value) must be of type Countable|array, Generator given diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt index 53e8611cf36c..46db7548266e 100644 --- a/Zend/tests/generators/errors/resume_running_generator_error.phpt +++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt @@ -8,7 +8,7 @@ function gen() { try { $gen->next(); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $gen->next(); } @@ -19,7 +19,7 @@ $gen->next(); ?> --EXPECTF-- -Exception: Cannot resume an already running generator +Error: Cannot resume an already running generator Fatal error: Uncaught Error: Cannot resume an already running generator in %s:%d Stack trace: diff --git a/Zend/tests/generators/errors/resume_running_generator_error_002.phpt b/Zend/tests/generators/errors/resume_running_generator_error_002.phpt index e71e32a886dc..0b58864cf42e 100644 --- a/Zend/tests/generators/errors/resume_running_generator_error_002.phpt +++ b/Zend/tests/generators/errors/resume_running_generator_error_002.phpt @@ -10,8 +10,8 @@ $gen = gen(); try { $gen->send($gen); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot resume an already running generator +Error: Cannot resume an already running generator diff --git a/Zend/tests/generators/generator_throwing_during_function_call.phpt b/Zend/tests/generators/generator_throwing_during_function_call.phpt index bd0d2448b7d8..0ac335acf8f6 100644 --- a/Zend/tests/generators/generator_throwing_during_function_call.phpt +++ b/Zend/tests/generators/generator_throwing_during_function_call.phpt @@ -20,7 +20,7 @@ var_dump($gen->current()); try { $gen->next(); } catch (Exception $e) { - echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($gen->current()); @@ -28,5 +28,5 @@ var_dump($gen->current()); ?> --EXPECT-- string(3) "foo" -Caught exception with message "test" +Exception: test NULL diff --git a/Zend/tests/generators/generator_throwing_exception.phpt b/Zend/tests/generators/generator_throwing_exception.phpt index f537c3fc7726..a984bb0e7031 100644 --- a/Zend/tests/generators/generator_throwing_exception.phpt +++ b/Zend/tests/generators/generator_throwing_exception.phpt @@ -16,7 +16,7 @@ var_dump($gen->current()); try { $gen->next(); } catch (Exception $e) { - echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($gen->current()); @@ -24,5 +24,5 @@ var_dump($gen->current()); ?> --EXPECT-- string(3) "foo" -Caught exception with message "test" +Exception: test NULL diff --git a/Zend/tests/generators/generator_with_type_check_2.phpt b/Zend/tests/generators/generator_with_type_check_2.phpt index 21e8ab8bedc0..5e8c928f8d94 100644 --- a/Zend/tests/generators/generator_with_type_check_2.phpt +++ b/Zend/tests/generators/generator_with_type_check_2.phpt @@ -6,7 +6,7 @@ function gen(array $a) { yield; } try { gen(42); } catch (TypeError $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -14,9 +14,9 @@ try { var_dump($val); } } catch (TypeError $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d -gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d +TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d +TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d diff --git a/Zend/tests/generators/get_return_and_finally.phpt b/Zend/tests/generators/get_return_and_finally.phpt index 150e5b83c4db..902d2e857642 100644 --- a/Zend/tests/generators/get_return_and_finally.phpt +++ b/Zend/tests/generators/get_return_and_finally.phpt @@ -31,17 +31,17 @@ try { // during auto-priming, so fails var_dump($gen->getReturn()); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // This fails, because the return value was discarded var_dump($gen->getReturn()); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(42) -gen2() throw -Cannot get return value of a generator that hasn't returned +Exception: gen2() throw +Exception: Cannot get return value of a generator that hasn't returned diff --git a/Zend/tests/generators/get_return_errors.phpt b/Zend/tests/generators/get_return_errors.phpt index f8d50aa3ded2..59c0792ca168 100644 --- a/Zend/tests/generators/get_return_errors.phpt +++ b/Zend/tests/generators/get_return_errors.phpt @@ -14,7 +14,7 @@ try { // Generator hasn't reached the "return" yet $gen->getReturn(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } function gen2() { @@ -27,13 +27,13 @@ $gen = gen2(); try { $gen->next(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // Generator has been aborted as a result of an exception $gen->getReturn(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } function gen3() { @@ -47,7 +47,7 @@ try { // Generator throws during auto-priming of getReturn() call $gen->getReturn(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } function gen4() { @@ -59,21 +59,21 @@ $gen = gen4(); try { $gen->throw(new Exception("gen4() throw")); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // Generator has been aborted as a result of an exception // that was injected using throw() $gen->getReturn(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot get return value of a generator that hasn't returned -gen2() throw -Cannot get return value of a generator that hasn't returned -gen3() throw -gen4() throw -Cannot get return value of a generator that hasn't returned +Exception: Cannot get return value of a generator that hasn't returned +Exception: gen2() throw +Exception: Cannot get return value of a generator that hasn't returned +Exception: gen3() throw +Exception: gen4() throw +Exception: Cannot get return value of a generator that hasn't returned diff --git a/Zend/tests/generators/gh11028_1.phpt b/Zend/tests/generators/gh11028_1.phpt index e1e7aa5019e5..98227ed07e15 100644 --- a/Zend/tests/generators/gh11028_1.phpt +++ b/Zend/tests/generators/gh11028_1.phpt @@ -15,7 +15,7 @@ function test($msg, $x) { try { var_dump([...generator($x)]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -26,10 +26,10 @@ test("object", new stdClass); ?> --EXPECT-- yield null -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking yield false -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking yield true -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking yield object -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking diff --git a/Zend/tests/generators/gh11028_3.phpt b/Zend/tests/generators/gh11028_3.phpt index 7ea1aac6f6cf..de9158d75e11 100644 --- a/Zend/tests/generators/gh11028_3.phpt +++ b/Zend/tests/generators/gh11028_3.phpt @@ -14,8 +14,8 @@ function generator() { try { var_dump([...generator()]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -exception +Exception: exception diff --git a/Zend/tests/generators/throw_into_yield_from_array.phpt b/Zend/tests/generators/throw_into_yield_from_array.phpt index aa9fa822061b..509108f8a62a 100644 --- a/Zend/tests/generators/throw_into_yield_from_array.phpt +++ b/Zend/tests/generators/throw_into_yield_from_array.phpt @@ -20,7 +20,7 @@ function test($g) { try { $g->throw(new Exception("Exception!")); } catch (Exception $e) { - echo "{$e->getMessage()}\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($g->current()); } @@ -35,9 +35,9 @@ test(yf(yielditer($data))); ?> --EXPECT-- int(1) -Exception! +Exception: Exception! NULL int(1) -Exception! +Exception: Exception! NULL diff --git a/Zend/tests/generators/yield_from_non_iterable.phpt b/Zend/tests/generators/yield_from_non_iterable.phpt index 705bcaec3511..41f0fe9e6357 100644 --- a/Zend/tests/generators/yield_from_non_iterable.phpt +++ b/Zend/tests/generators/yield_from_non_iterable.phpt @@ -10,9 +10,9 @@ function gen() { try { gen()->current(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Can use "yield from" only with arrays and Traversables +Error: Can use "yield from" only with arrays and Traversables diff --git a/Zend/tests/generators/yield_from_valid_exception.phpt b/Zend/tests/generators/yield_from_valid_exception.phpt index 0df541499cae..5bf524a67794 100644 --- a/Zend/tests/generators/yield_from_valid_exception.phpt +++ b/Zend/tests/generators/yield_from_valid_exception.phpt @@ -18,7 +18,7 @@ function gen() { // the fact that the yield from result is used is relevant. var_dump(yield from new FooBar); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,4 +27,4 @@ $x->current(); ?> --EXPECT-- -Exception from valid() +Exception: Exception from valid() diff --git a/Zend/tests/get_called_class_001.phpt b/Zend/tests/get_called_class_001.phpt index caa6d154d9c5..21a463cc6d8c 100644 --- a/Zend/tests/get_called_class_001.phpt +++ b/Zend/tests/get_called_class_001.phpt @@ -6,9 +6,9 @@ Calling get_called_class() outside a class try { var_dump(get_called_class()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -get_called_class() must be called from within a class +Error: get_called_class() must be called from within a class diff --git a/Zend/tests/get_class_basic.phpt b/Zend/tests/get_class_basic.phpt index f6dcbccb6916..d688f35a0008 100644 --- a/Zend/tests/get_class_basic.phpt +++ b/Zend/tests/get_class_basic.phpt @@ -12,7 +12,7 @@ class foo { try { var_dump(get_class(null)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -29,7 +29,7 @@ set_error_handler(function ($severity, $message, $file, $line) { try { $f1->bar(); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } set_error_handler(null); @@ -38,12 +38,12 @@ $f2->bar(); try { var_dump(get_class()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(get_class("qwerty")); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(get_class($f1)); @@ -54,13 +54,13 @@ $f1->testNull(); echo "Done\n"; ?> --EXPECTF-- -Calling get_class() without arguments is deprecated +Exception: Calling get_class() without arguments is deprecated Deprecated: Calling get_class() without arguments is deprecated in %s on line %d string(3) "foo" -get_class() without arguments must be called from within a class -get_class(): Argument #1 ($object) must be of type object, string given +Error: get_class() without arguments must be called from within a class +TypeError: get_class(): Argument #1 ($object) must be of type object, string given string(3) "foo" string(4) "foo2" -get_class(): Argument #1 ($object) must be of type object, null given +TypeError: get_class(): Argument #1 ($object) must be of type object, null given Done diff --git a/Zend/tests/get_class_vars/get_class_vars_001.phpt b/Zend/tests/get_class_vars/get_class_vars_001.phpt index 84f502610eca..7d2d5fbc3f9a 100644 --- a/Zend/tests/get_class_vars/get_class_vars_001.phpt +++ b/Zend/tests/get_class_vars/get_class_vars_001.phpt @@ -22,7 +22,7 @@ var_dump(get_class_vars('B')); try { get_class_vars("Unknown"); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -37,4 +37,4 @@ array(2) { ["aa"]=> int(4) } -get_class_vars(): Argument #1 ($class) must be a valid class name, Unknown given +TypeError: get_class_vars(): Argument #1 ($class) must be a valid class name, Unknown given diff --git a/Zend/tests/get_parent_class_basic.phpt b/Zend/tests/get_parent_class_basic.phpt index b439fbf9fb3e..02e7a07d2765 100644 --- a/Zend/tests/get_parent_class_basic.phpt +++ b/Zend/tests/get_parent_class_basic.phpt @@ -28,7 +28,7 @@ set_error_handler(function ($severity, $message, $file, $line) { try { $foo->test(); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } set_error_handler(null); @@ -45,19 +45,19 @@ var_dump(get_parent_class("i")); try { get_parent_class(""); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { get_parent_class("[[[["); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { get_parent_class(" "); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(get_parent_class(new stdclass)); @@ -65,19 +65,19 @@ var_dump(get_parent_class(new stdclass)); try { get_parent_class(array()); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { get_parent_class(1); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- -Calling get_parent_class() without arguments is deprecated +Exception: Calling get_parent_class() without arguments is deprecated Deprecated: Calling get_parent_class() without arguments is deprecated in %s on line %d bool(false) @@ -90,10 +90,10 @@ bool(false) string(3) "foo" bool(false) bool(false) -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given bool(false) -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Done diff --git a/Zend/tests/gh10169.phpt b/Zend/tests/gh10169.phpt index 674122ac5935..32a8aca6a603 100644 --- a/Zend/tests/gh10169.phpt +++ b/Zend/tests/gh10169.phpt @@ -20,7 +20,7 @@ $a = new A(); try { $a->prop = new B(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $a = new A(); @@ -28,10 +28,10 @@ $a->prop = ''; try { $a->prop = new B(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Object was released while assigning to property A::$prop -Object was released while assigning to property A::$prop +Error: Object was released while assigning to property A::$prop +Error: Object was released while assigning to property A::$prop diff --git a/Zend/tests/gh10497_non_object.phpt b/Zend/tests/gh10497_non_object.phpt index 546e9718443d..c5313cf75e93 100644 --- a/Zend/tests/gh10497_non_object.phpt +++ b/Zend/tests/gh10497_non_object.phpt @@ -6,19 +6,19 @@ GH-10497: Writing to a property of a non-object constant reports a runtime error try { TRUE->prop = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { NULL->prop = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { PHP_INT_MAX->prop = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } class C { @@ -34,38 +34,38 @@ class C { try { C::INT->prop = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::STR->prop = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::ARR->prop = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::fromSelf(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Other write contexts: compound assignment, unset() and by-reference arguments. try { C::INT->prop++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::INT->prop .= 'x'; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } function byRef(&$v) {} @@ -73,7 +73,7 @@ function byRef(&$v) {} try { byRef(C::INT->prop); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // As for plain variables, unsetting a property of a non-object is a silent no-op. @@ -86,26 +86,26 @@ var_dump(isset(C::INT->prop)); try { __COMPILER_HALT_OFFSET__->prop = 1; } catch (Error $e) { - echo $e::class, $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } __halt_compiler(); ?> --EXPECT-- -Attempt to assign property "prop" on true -Attempt to assign property "prop" on null -Attempt to assign property "prop" on int -Attempt to assign property "prop" on int -Attempt to assign property "prop" on string -Attempt to assign property "prop" on array -Attempt to assign property "prop" on int -Attempt to increment/decrement property "prop" on int -Attempt to assign property "prop" on int -Attempt to modify property "prop" on int +Error: Attempt to assign property "prop" on true +Error: Attempt to assign property "prop" on null +Error: Attempt to assign property "prop" on int +Error: Attempt to assign property "prop" on int +Error: Attempt to assign property "prop" on string +Error: Attempt to assign property "prop" on array +Error: Attempt to assign property "prop" on int +Error: Attempt to increment/decrement property "prop" on int +Error: Attempt to assign property "prop" on int +Error: Attempt to modify property "prop" on int unset() did not error bool(true) int(5) string(3) "str" bool(false) -ErrorAttempt to assign property "prop" on int +Error: Attempt to assign property "prop" on int diff --git a/Zend/tests/gh10634.phpt b/Zend/tests/gh10634.phpt index 41407bf307d7..cd36411b3792 100644 --- a/Zend/tests/gh10634.phpt +++ b/Zend/tests/gh10634.phpt @@ -6,7 +6,7 @@ function test_input($input) { try { eval($input); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -17,8 +17,8 @@ test_input("y&# "); test_input("y&//"); ?> --EXPECT-- -string(36) "Unterminated comment starting line 1" -string(36) "Unterminated comment starting line 1" -string(36) "syntax error, unexpected end of file" -string(36) "syntax error, unexpected end of file" -string(36) "syntax error, unexpected end of file" +ParseError: Unterminated comment starting line 1 +ParseError: Unterminated comment starting line 1 +ParseError: syntax error, unexpected end of file +ParseError: syntax error, unexpected end of file +ParseError: syntax error, unexpected end of file diff --git a/Zend/tests/gh12102_1.phpt b/Zend/tests/gh12102_1.phpt index 1d548d6b28f3..30608f54275a 100644 --- a/Zend/tests/gh12102_1.phpt +++ b/Zend/tests/gh12102_1.phpt @@ -8,7 +8,7 @@ function test() { try { byRef(func_get_args()[0]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,4 +27,4 @@ test('y'); ?> --EXPECT-- string(1) "y" -Cannot use temporary expression in write context +Error: Cannot use temporary expression in write context diff --git a/Zend/tests/gh12102_3.phpt b/Zend/tests/gh12102_3.phpt index 741bce5ab1ba..fd1b5fca9d24 100644 --- a/Zend/tests/gh12102_3.phpt +++ b/Zend/tests/gh12102_3.phpt @@ -8,7 +8,7 @@ function test() { try { byRef(C[0]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,4 +29,4 @@ test('y'); ?> --EXPECT-- string(3) "foo" -Cannot use temporary expression in write context +Error: Cannot use temporary expression in write context diff --git a/Zend/tests/gh14969.phpt b/Zend/tests/gh14969.phpt index dedbaa7456e0..a69a739f0e37 100644 --- a/Zend/tests/gh14969.phpt +++ b/Zend/tests/gh14969.phpt @@ -20,7 +20,7 @@ $d = new D(); try { $d->prop = $c; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($d); @@ -29,18 +29,18 @@ $d->prop = 'foo'; try { $d->prop = $c; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($d); ?> --EXPECTF-- -C::__toString +Exception: C::__toString object(D)#%d (0) { ["prop"]=> uninitialized(string) } -C::__toString +Exception: C::__toString object(D)#2 (1) { ["prop"]=> string(3) "foo" diff --git a/Zend/tests/gh17162.phpt b/Zend/tests/gh17162.phpt index bdf6ddbb36ba..d945c51e0037 100644 --- a/Zend/tests/gh17162.phpt +++ b/Zend/tests/gh17162.phpt @@ -14,8 +14,8 @@ $box = [new Test]; try { getimagesize("dummy", $box); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attempt to assign property "value" on null +Error: Attempt to assign property "value" on null diff --git a/Zend/tests/gh18736.phpt b/Zend/tests/gh18736.phpt index f397ee39a310..9eefbc6fdf7c 100644 --- a/Zend/tests/gh18736.phpt +++ b/Zend/tests/gh18736.phpt @@ -16,9 +16,9 @@ try { $x = &test(); var_dump($x); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -test(): Return value must be of type int, string returned +TypeError: test(): Return value must be of type int, string returned diff --git a/Zend/tests/gh19304.phpt b/Zend/tests/gh19304.phpt index 47e20af64623..099138319ad8 100644 --- a/Zend/tests/gh19304.phpt +++ b/Zend/tests/gh19304.phpt @@ -10,9 +10,9 @@ $foo = new class { try { $foo->v = 0; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign int to property class@anonymous::$v of type self +TypeError: Cannot assign int to property class@anonymous::$v of type self diff --git a/Zend/tests/gh19306.phpt b/Zend/tests/gh19306.phpt index e19735d94c84..9f98dd4cc6e2 100644 --- a/Zend/tests/gh19306.phpt +++ b/Zend/tests/gh19306.phpt @@ -26,7 +26,7 @@ echo "Fiber suspended\n"; try { $a->next(); } catch (Throwable $t) { - echo $t->getMessage(), "\n"; + echo $t::class, ': ', $t->getMessage(), "\n"; } echo "Destroying fiber\n"; $fiber = null; @@ -35,6 +35,6 @@ echo "Shutdown\n"; --EXPECT-- Fiber start Fiber suspended -Cannot resume an already running generator +Error: Cannot resume an already running generator Destroying fiber Shutdown diff --git a/Zend/tests/gh19326.phpt b/Zend/tests/gh19326.phpt index 335fdd382ea6..07e93c96bb37 100644 --- a/Zend/tests/gh19326.phpt +++ b/Zend/tests/gh19326.phpt @@ -26,11 +26,11 @@ $fiber->start(); try { $b->throw(new Exception('test')); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $fiber->resume(); ?> --EXPECT-- -Cannot resume an already running generator +Error: Cannot resume an already running generator diff --git a/Zend/tests/gh19719.phpt b/Zend/tests/gh19719.phpt index 715e847846fe..4a09b5e57381 100644 --- a/Zend/tests/gh19719.phpt +++ b/Zend/tests/gh19719.phpt @@ -13,9 +13,9 @@ function takesInt(int $x) {} try { takesInt('42'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d +TypeError: takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d diff --git a/Zend/tests/gh20564.phpt b/Zend/tests/gh20564.phpt index 53311d952de7..6962c7f19bd9 100644 --- a/Zend/tests/gh20564.phpt +++ b/Zend/tests/gh20564.phpt @@ -16,9 +16,9 @@ class A { try { (new A)->test(); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -array_map(): Argument #1 ($callback) must be a valid callback or null, class "B" not found +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, class "B" not found diff --git a/Zend/tests/gh23088.phpt b/Zend/tests/gh23088.phpt index 59153a1f2ba3..c7bc9ab0dc17 100644 --- a/Zend/tests/gh23088.phpt +++ b/Zend/tests/gh23088.phpt @@ -25,16 +25,16 @@ for ($i = 0; $i < 20000; $i++) { try { var_dump($a == $b); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($a === $b); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Maximum call stack size reached during comparison -Maximum call stack size reached during comparison +Error: Maximum call stack size reached during comparison +Error: Maximum call stack size reached during comparison diff --git a/Zend/tests/gh23121.phpt b/Zend/tests/gh23121.phpt index 158794ba04e3..31abd7c56c71 100644 --- a/Zend/tests/gh23121.phpt +++ b/Zend/tests/gh23121.phpt @@ -11,26 +11,26 @@ var_dump(is_callable($sxe)); try { $sxe(); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func($sxe); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { libxml_set_external_entity_loader($sxe); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(libxml_get_external_entity_loader()); ?> --EXPECT-- bool(false) -Object of type SimpleXMLElement is not callable -call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given -libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, no array or string given +Error: Object of type SimpleXMLElement is not callable +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given +TypeError: libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, no array or string given NULL diff --git a/Zend/tests/gh418106144.phpt b/Zend/tests/gh418106144.phpt index 9357b0a179b1..e96bfe53cedf 100644 --- a/Zend/tests/gh418106144.phpt +++ b/Zend/tests/gh418106144.phpt @@ -12,9 +12,9 @@ function test($y=new Foo>''){ try { test(); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Foo::__toString(): Return value must be of type string, none returned +TypeError: Foo::__toString(): Return value must be of type string, none returned diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt index d0e9ddcba410..cb0df14a4745 100644 --- a/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt +++ b/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt @@ -18,9 +18,9 @@ $foo = new Foo(); try { $foo->foo()->baz ??= 1; } catch (Exception $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Hello +Exception: Hello diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt index 4115d9eae26f..e0ffe3addcd8 100644 --- a/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt +++ b/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt @@ -16,9 +16,9 @@ $foo = new Foo(); try { $foo->foo()->prop ??= 'foo'; } catch (Error $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to property Foo::$prop of type int +TypeError: Cannot assign string to property Foo::$prop of type int diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt index f2808afbf84d..e892a17d7ca4 100644 --- a/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt +++ b/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt @@ -14,9 +14,9 @@ function newFoo() { try { newFoo()->prop ??= 'foo'; } catch (Error $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to property Foo::$prop of type int +TypeError: Cannot assign string to property Foo::$prop of type int diff --git a/Zend/tests/global_to_string_exception.phpt b/Zend/tests/global_to_string_exception.phpt index 0c55a8c3d624..02e0b5410121 100644 --- a/Zend/tests/global_to_string_exception.phpt +++ b/Zend/tests/global_to_string_exception.phpt @@ -6,9 +6,9 @@ To string conversion failure in global try { global ${new stdClass}; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string diff --git a/Zend/tests/illegal_offset_unset_isset_empty.phpt b/Zend/tests/illegal_offset_unset_isset_empty.phpt index ee837f0b6143..eef2dbc2e8fd 100644 --- a/Zend/tests/illegal_offset_unset_isset_empty.phpt +++ b/Zend/tests/illegal_offset_unset_isset_empty.phpt @@ -7,21 +7,21 @@ $ary = []; try { unset($ary[[]]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($ary[[]]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { empty($ary[[]]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot unset offset of type array on array -Cannot access offset of type array in isset or empty -Cannot access offset of type array in isset or empty +TypeError: Cannot unset offset of type array on array +TypeError: Cannot access offset of type array in isset or empty +TypeError: Cannot access offset of type array in isset or empty diff --git a/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt b/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt index 21b4a9b01684..f4eec14fb4a0 100644 --- a/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt +++ b/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt @@ -14,25 +14,25 @@ $nf = new NumericCastableNoOperations(58.3); try { var_dump($l - 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($f - 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nl - 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nf - 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } /* Decrement */ @@ -40,37 +40,37 @@ try { $l--; var_dump($l); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f--; var_dump($f); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nl--; var_dump($nl); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nf--; var_dump($nf); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: LongCastableNoOperations - int -Unsupported operand types: FloatCastableNoOperations - int +TypeError: Unsupported operand types: LongCastableNoOperations - int +TypeError: Unsupported operand types: FloatCastableNoOperations - int int(51) float(57.3) -Cannot decrement LongCastableNoOperations -Cannot decrement FloatCastableNoOperations +TypeError: Cannot decrement LongCastableNoOperations +TypeError: Cannot decrement FloatCastableNoOperations int(51) float(57.3) diff --git a/Zend/tests/in-de-crement/incdec_bool_exception.phpt b/Zend/tests/in-de-crement/incdec_bool_exception.phpt index f819af1e2395..20e5d3a4501a 100644 --- a/Zend/tests/in-de-crement/incdec_bool_exception.phpt +++ b/Zend/tests/in-de-crement/incdec_bool_exception.phpt @@ -12,17 +12,17 @@ foreach ($values as $value) { try { $value++; } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $value--; } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Increment on type bool has no effect, this will change in the next major version of PHP -Decrement on type bool has no effect, this will change in the next major version of PHP -Increment on type bool has no effect, this will change in the next major version of PHP -Decrement on type bool has no effect, this will change in the next major version of PHP +Exception: Increment on type bool has no effect, this will change in the next major version of PHP +Exception: Decrement on type bool has no effect, this will change in the next major version of PHP +Exception: Increment on type bool has no effect, this will change in the next major version of PHP +Exception: Decrement on type bool has no effect, this will change in the next major version of PHP diff --git a/Zend/tests/in-de-crement/incdec_strings_exception.phpt b/Zend/tests/in-de-crement/incdec_strings_exception.phpt index 5acbb1041222..d4b17ba10f17 100644 --- a/Zend/tests/in-de-crement/incdec_strings_exception.phpt +++ b/Zend/tests/in-de-crement/incdec_strings_exception.phpt @@ -29,47 +29,47 @@ foreach ($values as $value) { try { $value++; } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($value); try { $value--; } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($value); } ?> --EXPECT-- -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(0) "" -Deprecated: Decrement on empty string is deprecated as non-numeric +Exception: Deprecated: Decrement on empty string is deprecated as non-numeric string(0) "" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(1) " " -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(1) " " -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "199A" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "199A" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "A199" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "A199" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "199Z" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "199Z" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "Z199" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "Z199" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(11) "Hello world" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(11) "Hello world" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "🐘" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "🐘" diff --git a/Zend/tests/in-de-crement/incdec_types.phpt b/Zend/tests/in-de-crement/incdec_types.phpt index 755b63957ef3..95856dde7eb0 100644 --- a/Zend/tests/in-de-crement/incdec_types.phpt +++ b/Zend/tests/in-de-crement/incdec_types.phpt @@ -10,12 +10,12 @@ foreach ($types as $type) { try { $type++; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $type--; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -40,12 +40,12 @@ foreach ($values as $value) { } ?> --EXPECTF-- -Cannot increment array -Cannot decrement array -Cannot increment stdClass -Cannot decrement stdClass -Cannot increment resource -Cannot decrement resource +TypeError: Cannot increment array +TypeError: Cannot decrement array +TypeError: Cannot increment stdClass +TypeError: Cannot decrement stdClass +TypeError: Cannot increment resource +TypeError: Cannot decrement resource Using increment: Initial value:NULL Result value:int(1) diff --git a/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt b/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt index cf08055383ed..4b3eb979f5bf 100644 --- a/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt +++ b/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt @@ -14,25 +14,25 @@ $nf = new NumericCastableNoOperations(58.3); try { var_dump($l + 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($f + 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nl + 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nf + 1); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } /* Decrement */ @@ -40,37 +40,37 @@ try { $l++; var_dump($l); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f++; var_dump($f); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nl++; var_dump($nl); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nf++; var_dump($nf); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: LongCastableNoOperations + int -Unsupported operand types: FloatCastableNoOperations + int +TypeError: Unsupported operand types: LongCastableNoOperations + int +TypeError: Unsupported operand types: FloatCastableNoOperations + int int(53) float(59.3) -Cannot increment LongCastableNoOperations -Cannot increment FloatCastableNoOperations +TypeError: Cannot increment LongCastableNoOperations +TypeError: Cannot increment FloatCastableNoOperations int(53) float(59.3) diff --git a/Zend/tests/in-de-crement/object_cannot_incdec.phpt b/Zend/tests/in-de-crement/object_cannot_incdec.phpt index 39a41d61dd3e..422b93204c24 100644 --- a/Zend/tests/in-de-crement/object_cannot_incdec.phpt +++ b/Zend/tests/in-de-crement/object_cannot_incdec.phpt @@ -8,38 +8,38 @@ $o = new Foo; try { $o++; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $o--; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { ++$o; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { --$o; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } ?> --EXPECT-- -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } diff --git a/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt b/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt index b4c193a67182..f9cc15f678d0 100644 --- a/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt +++ b/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt @@ -8,38 +8,38 @@ $o = new Foo; try { $y = $o++; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $y = $o--; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $y = ++$o; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $y = --$o; } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } ?> --EXPECT-- -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } diff --git a/Zend/tests/in-de-crement/oss_fuzz_63802.phpt b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt index 51b4c8f1fd72..183221b2b217 100644 --- a/Zend/tests/in-de-crement/oss_fuzz_63802.phpt +++ b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt @@ -22,13 +22,13 @@ foreach (['pre', 'post'] as $prePost) { try { $foo->{$prePost . ucfirst($incDec)}(); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } ?> --EXPECT-- -Cannot increment Foo -Cannot decrement Foo -Cannot increment Foo -Cannot decrement Foo +TypeError: Cannot increment Foo +TypeError: Cannot decrement Foo +TypeError: Cannot increment Foo +TypeError: Cannot decrement Foo diff --git a/Zend/tests/in-de-crement/overloaded_access.phpt b/Zend/tests/in-de-crement/overloaded_access.phpt index 56a5c2b1d47a..feb15c60c6cf 100644 --- a/Zend/tests/in-de-crement/overloaded_access.phpt +++ b/Zend/tests/in-de-crement/overloaded_access.phpt @@ -22,15 +22,15 @@ $foo = new Foo; try { $foo[0]++; } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } $foo = new Foo; try { $foo[0]--; } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Cannot increment array -Cannot decrement array +TypeError: Cannot increment array +TypeError: Cannot decrement array diff --git a/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt b/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt index d435c9fb4029..7ba4e662f69a 100644 --- a/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt +++ b/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt @@ -15,11 +15,11 @@ unset($c->a); try { (++$c->a); } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($c->a); ?> --EXPECT-- -Cannot increment stdClass +TypeError: Cannot increment stdClass object(stdClass)#2 (0) { } diff --git a/Zend/tests/include_stat_is_quiet.phpt b/Zend/tests/include_stat_is_quiet.phpt index 39eb3053fbe4..57138ddd06c6 100644 --- a/Zend/tests/include_stat_is_quiet.phpt +++ b/Zend/tests/include_stat_is_quiet.phpt @@ -21,7 +21,7 @@ set_include_path('test://foo:test://bar'); try { require_once 'doesnt_exist.php'; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt index 3fe0456175f0..a50c769b3da7 100644 --- a/Zend/tests/incompat_ctx_user.phpt +++ b/Zend/tests/incompat_ctx_user.phpt @@ -13,8 +13,8 @@ $b = new B; try { $b->bar(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Non-static method A::foo() cannot be called statically +Error: Non-static method A::foo() cannot be called statically diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt index 66b20da03a03..d98e793232af 100644 --- a/Zend/tests/indexing_001.phpt +++ b/Zend/tests/indexing_001.phpt @@ -10,7 +10,7 @@ foreach ($testvalues as $testvalue) { try { $testvalue['foo']=$array; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($testvalue); } @@ -22,7 +22,7 @@ foreach ($testvalues as $testvalue) { try { $testvalue['foo']=&$array; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($testvalue); } @@ -34,7 +34,7 @@ foreach ($testvalues as $testvalue) { try { $testvalue[]=$array; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump ($testvalue); } @@ -46,7 +46,7 @@ foreach ($testvalues as $testvalue) { try { $testvalue[]=&$array; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump ($testvalue); } @@ -61,11 +61,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -76,11 +76,11 @@ array(1) { int(1) } } -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(0) "" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(1) " " -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { ["foo"]=> @@ -98,11 +98,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -113,7 +113,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { ["foo"]=> @@ -130,11 +130,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -145,7 +145,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { [0]=> @@ -163,11 +163,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -178,7 +178,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { [0]=> diff --git a/Zend/tests/indirect_function_call/indirect_call_array_003.phpt b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt index 603b3bfc299b..30d84109ce31 100644 --- a/Zend/tests/indirect_function_call/indirect_call_array_003.phpt +++ b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt @@ -20,7 +20,7 @@ $arr = array('foo', 'abc'); try { $arr(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo = new foo; $arr = array($foo, 'abc'); @@ -31,7 +31,7 @@ $arr(); --EXPECTF-- From foo::__callStatic: string(3) "abc" -Exception: Using $this when not in object context +Error: Using $this when not in object context From foo::__call: string(3) "abc" object(foo)#%d (0) { diff --git a/Zend/tests/indirect_function_call/indirect_call_array_004.phpt b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt index e8520efd12b0..ed3cb5c28b8a 100644 --- a/Zend/tests/indirect_function_call/indirect_call_array_004.phpt +++ b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt @@ -24,7 +24,7 @@ try { $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $arr = array('foo', '123'); @@ -33,7 +33,7 @@ try { $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -46,7 +46,7 @@ try { $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -57,15 +57,15 @@ try { $arr(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -foo +Exception: foo From foo::__callStatic: -123 +Exception: 123 ------ -foo +Exception: foo From foo::__call: -123 +Exception: 123 diff --git a/Zend/tests/indirect_function_call/indirect_call_string_002.phpt b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt index 7704c1cd9a4d..348922169e5b 100644 --- a/Zend/tests/indirect_function_call/indirect_call_string_002.phpt +++ b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt @@ -23,7 +23,7 @@ $callback = ['', 'method']; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test Class::method syntax with empty class name @@ -31,7 +31,7 @@ $callback = '::method'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test array syntax with empty class and method name @@ -39,7 +39,7 @@ $callback = ['', '']; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test Class::method syntax with empty class and method name @@ -47,7 +47,7 @@ $callback = '::'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test string ending in single colon @@ -55,7 +55,7 @@ $callback = 'Class:'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test string beginning in single colon @@ -63,7 +63,7 @@ $callback = ':method'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test single colon @@ -71,16 +71,16 @@ $callback = ':'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(0) "" string(0) "" -Class "" not found -Class "" not found -Class "" not found -Class "" not found -Call to undefined function Class:() -Call to undefined function :method() -Call to undefined function :() +Error: Class "" not found +Error: Class "" not found +Error: Class "" not found +Error: Class "" not found +Error: Call to undefined function Class:() +Error: Call to undefined function :method() +Error: Call to undefined function :() diff --git a/Zend/tests/indirect_function_call/indirect_method_call_001.phpt b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt index 39967fdb267d..b2aa97cc9784 100644 --- a/Zend/tests/indirect_function_call/indirect_method_call_001.phpt +++ b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt @@ -12,9 +12,9 @@ class foo { try { $X = (new foo)->Inexistent(3); } catch (Exception $e) { - var_dump($e->getMessage()); // foobar + echo $e::class, ': ', $e->getMessage(), "\n"; // foobar } ?> --EXPECT-- -string(6) "foobar" +Exception: foobar diff --git a/Zend/tests/init_array_illegal_offset_type.phpt b/Zend/tests/init_array_illegal_offset_type.phpt index ee41c0217ad7..d895ed053424 100644 --- a/Zend/tests/init_array_illegal_offset_type.phpt +++ b/Zend/tests/init_array_illegal_offset_type.phpt @@ -8,8 +8,8 @@ function test() { try { test(); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access offset of type stdClass on array +TypeError: Cannot access offset of type stdClass on array diff --git a/Zend/tests/int_static_prop_name.phpt b/Zend/tests/int_static_prop_name.phpt index e29e2514bb97..c7a366da66bd 100644 --- a/Zend/tests/int_static_prop_name.phpt +++ b/Zend/tests/int_static_prop_name.phpt @@ -17,19 +17,19 @@ var_dump(${(int) $n}); try { var_dump(Foo::${42}); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::${(int) 42}); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::${(int) $n}); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -37,6 +37,6 @@ try { int(24) int(24) int(24) -Access to undeclared static property Foo::$42 -Access to undeclared static property Foo::$42 -Access to undeclared static property Foo::$42 +Error: Access to undeclared static property Foo::$42 +Error: Access to undeclared static property Foo::$42 +Error: Access to undeclared static property Foo::$42 diff --git a/Zend/tests/invalid_parent_const_ref_leak.phpt b/Zend/tests/invalid_parent_const_ref_leak.phpt index ed728f7d45e4..605c1524fb56 100644 --- a/Zend/tests/invalid_parent_const_ref_leak.phpt +++ b/Zend/tests/invalid_parent_const_ref_leak.phpt @@ -10,9 +10,9 @@ class A { try { A::B; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access "parent" when current class scope has no parent +Error: Cannot access "parent" when current class scope has no parent diff --git a/Zend/tests/isset/isset_array.phpt b/Zend/tests/isset/isset_array.phpt index 48e908a36d56..92bac0c8e932 100644 --- a/Zend/tests/isset/isset_array.phpt +++ b/Zend/tests/isset/isset_array.phpt @@ -25,13 +25,13 @@ var_dump(isset($array[STDIN])); try { isset($array[[]]); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { isset($array[new stdClass()]); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECTF-- @@ -48,5 +48,5 @@ bool(false) Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d bool(false) -Cannot access offset of type array in isset or empty -Cannot access offset of type stdClass in isset or empty +TypeError: Cannot access offset of type array in isset or empty +TypeError: Cannot access offset of type stdClass in isset or empty diff --git a/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt b/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt index c46756718649..a9abb9e9b606 100644 --- a/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt +++ b/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt @@ -33,7 +33,7 @@ var_dump($object2); try { var_dump($object1->propB); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // The state of both objects is unchanged @@ -52,7 +52,7 @@ lazy ghost object(MyClass)#%d (1) { ["propA"]=> string(8) "object-2" } -initializer exception +Exception: initializer exception lazy ghost object(MyClass)#%d (1) { ["propA"]=> string(8) "object-1" diff --git a/Zend/tests/lazy_objects/typed_properties_001.phpt b/Zend/tests/lazy_objects/typed_properties_001.phpt index 1f457531d87c..3f4c1d1b2734 100644 --- a/Zend/tests/lazy_objects/typed_properties_001.phpt +++ b/Zend/tests/lazy_objects/typed_properties_001.phpt @@ -21,13 +21,13 @@ $ref = "foobar"; try { $test->$name =& $ref; } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); ?> --EXPECTF-- -Cannot assign string to property Test::$prop of type int +TypeError: Cannot assign string to property Test::$prop of type int lazy proxy object(Test)#%d (1) { ["instance"]=> object(Test)#%d (0) { diff --git a/Zend/tests/live_range_phi_leak.phpt b/Zend/tests/live_range_phi_leak.phpt index f07258405301..f31840d5150f 100644 --- a/Zend/tests/live_range_phi_leak.phpt +++ b/Zend/tests/live_range_phi_leak.phpt @@ -12,8 +12,8 @@ function test($k) { try { test(new stdClass); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Test +Exception: Test diff --git a/Zend/tests/magic_methods/bug26166.phpt b/Zend/tests/magic_methods/bug26166.phpt index 3e5c6daa21d4..99f4a1e08e7b 100644 --- a/Zend/tests/magic_methods/bug26166.phpt +++ b/Zend/tests/magic_methods/bug26166.phpt @@ -41,7 +41,7 @@ $o = new NoneTest; try { echo $o; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "===THROW===\n"; @@ -57,13 +57,13 @@ $o = new ErrorTest; try { echo $o; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- Hello World! ===NONE=== -NoneTest::__toString(): Return value must be of type string, none returned +TypeError: NoneTest::__toString(): Return value must be of type string, none returned ===THROW=== -This is an error! +Exception: This is an error! diff --git a/Zend/tests/magic_methods/bug29368_2.phpt b/Zend/tests/magic_methods/bug29368_2.phpt index e13d6da88467..fda92130c504 100644 --- a/Zend/tests/magic_methods/bug29368_2.phpt +++ b/Zend/tests/magic_methods/bug29368_2.phpt @@ -12,10 +12,10 @@ class Bomb { try { $x = new ReflectionMethod(new Bomb(), "foo"); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "ok\n"; ?> --EXPECT-- -bomb! +Exception: bomb! ok diff --git a/Zend/tests/magic_methods/bug45186.phpt b/Zend/tests/magic_methods/bug45186.phpt index 9e0078d77002..f0796278c58a 100644 --- a/Zend/tests/magic_methods/bug45186.phpt +++ b/Zend/tests/magic_methods/bug45186.phpt @@ -34,7 +34,7 @@ call_user_func('BAR::www'); try { call_user_func('self::y'); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -58,4 +58,4 @@ string(1) "y" ok __callstatic: string(3) "www" -call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active diff --git a/Zend/tests/magic_methods/bug45186_2.phpt b/Zend/tests/magic_methods/bug45186_2.phpt index e85528ce8b00..eec4b3ab3bcb 100644 --- a/Zend/tests/magic_methods/bug45186_2.phpt +++ b/Zend/tests/magic_methods/bug45186_2.phpt @@ -29,12 +29,12 @@ call_user_func(array('BAR','x')); try { call_user_func('BAR::www'); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func('self::y'); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -56,5 +56,5 @@ Deprecated: Use of "self" in callables is deprecated in %s on line %d __call: string(1) "y" ok -call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www" -call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www" +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active diff --git a/Zend/tests/magic_methods/bug76667.phpt b/Zend/tests/magic_methods/bug76667.phpt index 03bd490a0409..32c237fe8c6b 100644 --- a/Zend/tests/magic_methods/bug76667.phpt +++ b/Zend/tests/magic_methods/bug76667.phpt @@ -19,11 +19,11 @@ $x = new T; try { $x->x = 1; } catch (\DivisionByZeroError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $undefined in %s on line %d Warning: Attempt to read property "1" on null in %s on line %d -Division by zero +DivisionByZeroError: Division by zero diff --git a/Zend/tests/match/043.phpt b/Zend/tests/match/043.phpt index 03ff0cbf36d6..14ca1a3821ae 100644 --- a/Zend/tests/match/043.phpt +++ b/Zend/tests/match/043.phpt @@ -9,7 +9,7 @@ function test(mixed $var) { try { match($var) {}; } catch (UnhandledMatchError $e) { - print $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,14 +27,14 @@ test(str_repeat('e', 100)); test(str_repeat("e\n", 100)); ?> --EXPECT-- -Unhandled match case NULL -Unhandled match case 1 -Unhandled match case 5.5 -Unhandled match case 5.0 -Unhandled match case 'foo' -Unhandled match case true -Unhandled match case false -Unhandled match case of type array -Unhandled match case of type Beep -Unhandled match case 'eeeeeeeeeeeeeee...' -Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...' +UnhandledMatchError: Unhandled match case NULL +UnhandledMatchError: Unhandled match case 1 +UnhandledMatchError: Unhandled match case 5.5 +UnhandledMatchError: Unhandled match case 5.0 +UnhandledMatchError: Unhandled match case 'foo' +UnhandledMatchError: Unhandled match case true +UnhandledMatchError: Unhandled match case false +UnhandledMatchError: Unhandled match case of type array +UnhandledMatchError: Unhandled match case of type Beep +UnhandledMatchError: Unhandled match case 'eeeeeeeeeeeeeee...' +UnhandledMatchError: Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...' diff --git a/Zend/tests/match/045.phpt b/Zend/tests/match/045.phpt index da8991cf595c..0857c6734af2 100644 --- a/Zend/tests/match/045.phpt +++ b/Zend/tests/match/045.phpt @@ -11,8 +11,8 @@ function test() { try { test(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "x" +Error: Undefined constant "x" diff --git a/Zend/tests/match/048.phpt b/Zend/tests/match/048.phpt index e5c6bb2e0bcb..0c1fe271fc7a 100644 --- a/Zend/tests/match/048.phpt +++ b/Zend/tests/match/048.phpt @@ -11,7 +11,7 @@ function test(mixed $var) { try { match($var) {}; } catch (UnhandledMatchError $e) { - print $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,14 +29,14 @@ test(str_repeat('e', 100)); test(str_repeat("e\n", 100)); ?> --EXPECT-- -Unhandled match case NULL -Unhandled match case 1 -Unhandled match case 5.5 -Unhandled match case 5.0 -Unhandled match case of type string -Unhandled match case true -Unhandled match case false -Unhandled match case of type array -Unhandled match case of type Beep -Unhandled match case of type string -Unhandled match case of type string +UnhandledMatchError: Unhandled match case NULL +UnhandledMatchError: Unhandled match case 1 +UnhandledMatchError: Unhandled match case 5.5 +UnhandledMatchError: Unhandled match case 5.0 +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case true +UnhandledMatchError: Unhandled match case false +UnhandledMatchError: Unhandled match case of type array +UnhandledMatchError: Unhandled match case of type Beep +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type string diff --git a/Zend/tests/match/049.phpt b/Zend/tests/match/049.phpt index 2a2385f704ff..8ec851649d40 100644 --- a/Zend/tests/match/049.phpt +++ b/Zend/tests/match/049.phpt @@ -11,7 +11,7 @@ function test(mixed $var) { try { match($var) {}; } catch (UnhandledMatchError $e) { - print $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,14 +29,14 @@ test(str_repeat('e', 100)); test(str_repeat("e\n", 100)); ?> --EXPECT-- -Unhandled match case of type null -Unhandled match case of type int -Unhandled match case of type float -Unhandled match case of type float -Unhandled match case of type string -Unhandled match case of type bool -Unhandled match case of type bool -Unhandled match case of type array -Unhandled match case of type Beep -Unhandled match case of type string -Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type null +UnhandledMatchError: Unhandled match case of type int +UnhandledMatchError: Unhandled match case of type float +UnhandledMatchError: Unhandled match case of type float +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type bool +UnhandledMatchError: Unhandled match case of type bool +UnhandledMatchError: Unhandled match case of type array +UnhandledMatchError: Unhandled match case of type Beep +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type string diff --git a/Zend/tests/match/unmatched_enum.phpt b/Zend/tests/match/unmatched_enum.phpt index 93f368a316b6..a92d905fbe83 100644 --- a/Zend/tests/match/unmatched_enum.phpt +++ b/Zend/tests/match/unmatched_enum.phpt @@ -13,9 +13,9 @@ try { Foo::Baz => 42, }; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unhandled match case Foo::Bar +UnhandledMatchError: Unhandled match case Foo::Bar diff --git a/Zend/tests/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt index 7a8ab5a2647b..c1ea2867f0c6 100644 --- a/Zend/tests/methods-on-non-objects-call-user-func.phpt +++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt @@ -6,8 +6,8 @@ $comparator = null; try { var_dump(call_user_func([$comparator, 'compare'], 1, 2)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object diff --git a/Zend/tests/methods-on-non-objects-catch.phpt b/Zend/tests/methods-on-non-objects-catch.phpt index b090437084ff..2c2bbd7c1072 100644 --- a/Zend/tests/methods-on-non-objects-catch.phpt +++ b/Zend/tests/methods-on-non-objects-catch.phpt @@ -10,11 +10,10 @@ $x= null; try { var_dump($x->method()); } catch (Error $e) { - var_dump($e->getCode(), $e->getMessage()); + echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n"; } echo "Alive\n"; ?> --EXPECTF-- -int(0) -string(%d) "Call to a member function method() on null" +Error: 0: Call to a member function method() on null Alive diff --git a/Zend/tests/methods-on-non-objects-usort.phpt b/Zend/tests/methods-on-non-objects-usort.phpt index 8a89023b7e81..3d216af74c3d 100644 --- a/Zend/tests/methods-on-non-objects-usort.phpt +++ b/Zend/tests/methods-on-non-objects-usort.phpt @@ -12,7 +12,7 @@ usort($list, function($a, $b) use ($comparator) { try { return $comparator->compare($a, $b); } catch (Error $e) { - var_dump($e->getCode(), $e->getMessage()); + echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n"; return 0; } }); @@ -20,14 +20,10 @@ var_dump($list); echo "Alive\n"; ?> --EXPECT-- -int(0) -string(43) "Call to a member function compare() on null" -int(0) -string(43) "Call to a member function compare() on null" -int(0) -string(43) "Call to a member function compare() on null" -int(0) -string(43) "Call to a member function compare() on null" +Error: 0: Call to a member function compare() on null +Error: 0: Call to a member function compare() on null +Error: 0: Call to a member function compare() on null +Error: 0: Call to a member function compare() on null array(5) { [0]=> int(1) diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt index 5c543a26192c..6c161efe323f 100644 --- a/Zend/tests/mod_001.phpt +++ b/Zend/tests/mod_001.phpt @@ -10,11 +10,11 @@ try { $c = $a % $b; var_dump($c); } catch (TypeError $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: array % array +TypeError: Unsupported operand types: array % array Done diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt index ddb657685302..3ead1f34e1ac 100644 --- a/Zend/tests/mul_001.phpt +++ b/Zend/tests/mul_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/named_params/__invoke.phpt b/Zend/tests/named_params/__invoke.phpt index 6ebbac0f07f4..f50743b8d8f7 100644 --- a/Zend/tests/named_params/__invoke.phpt +++ b/Zend/tests/named_params/__invoke.phpt @@ -22,7 +22,7 @@ $test(b: 'B'); try { $test(b: 'B', c: 'C'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -39,14 +39,14 @@ $test3(b: 'B'); try { $test3(b: 'B', c: 'C'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- a: A, b: B a: a, b: B -Unknown named parameter $c +Error: Unknown named parameter $c a: A, b: B array(1) { @@ -61,4 +61,4 @@ array(1) { a: A, b: B a: a, b: B -Unknown named parameter $c +Error: Unknown named parameter $c diff --git a/Zend/tests/named_params/assert.phpt b/Zend/tests/named_params/assert.phpt index 40a92a2f1fec..a65ae460126c 100644 --- a/Zend/tests/named_params/assert.phpt +++ b/Zend/tests/named_params/assert.phpt @@ -7,24 +7,24 @@ assert(assertion: true); try { assert(assertion: false); } catch (AssertionError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } assert(assertion: true, description: "Description"); try { assert(assertion: false, description: "Description"); } catch (AssertionError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(description: "Description"); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(assertion: false) -Description -Named parameter $description overwrites previous argument +AssertionError: assert(assertion: false) +AssertionError: Description +Error: Named parameter $description overwrites previous argument diff --git a/Zend/tests/named_params/attributes.phpt b/Zend/tests/named_params/attributes.phpt index 94d2fad19f4d..9b16feb724d7 100644 --- a/Zend/tests/named_params/attributes.phpt +++ b/Zend/tests/named_params/attributes.phpt @@ -27,7 +27,7 @@ $attr = (new ReflectionClass(Test2::class))->getAttributes()[0]; try { var_dump($attr->newInstance()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -47,4 +47,4 @@ object(MyAttribute)#1 (3) { ["c"]=> string(1) "C" } -Named parameter $a overwrites previous argument +Error: Named parameter $a overwrites previous argument diff --git a/Zend/tests/named_params/call_user_func.phpt b/Zend/tests/named_params/call_user_func.phpt index 50f2ed588e92..a11198a7fca3 100644 --- a/Zend/tests/named_params/call_user_func.phpt +++ b/Zend/tests/named_params/call_user_func.phpt @@ -37,17 +37,17 @@ var_dump(call_user_func('call_user_func', $test, c: 'D')); try { call_user_func($test_required, b: 'B'); } catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(call_user_func('array_slice', [1, 2, 3, 4, 5], length: 2)); } catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(call_user_func('array_slice', [1, 2, 3, 4, 'x' => 5], 3, preserve_keys: true)); } catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -82,8 +82,8 @@ array(2) { Warning: {closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d a = a, b = b, c = D NULL -{closure:%s:%d}(): Argument #1 ($a) not passed -array_slice(): Argument #2 ($offset) not passed +ArgumentCountError: {closure:%s:%d}(): Argument #1 ($a) not passed +ArgumentCountError: array_slice(): Argument #2 ($offset) not passed array(2) { [3]=> int(4) diff --git a/Zend/tests/named_params/call_user_func_array.phpt b/Zend/tests/named_params/call_user_func_array.phpt index ebee06ea6af7..8dde83574c17 100644 --- a/Zend/tests/named_params/call_user_func_array.phpt +++ b/Zend/tests/named_params/call_user_func_array.phpt @@ -18,12 +18,12 @@ namespace { try { call_user_func_array($test, ['d' => 'D']); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func_array($test, ['c' => 'C', 'A']); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; } @@ -36,12 +36,12 @@ namespace Foo { try { call_user_func_array($test, ['d' => 'D']); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func_array($test, ['c' => 'C', 'A']); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -56,8 +56,8 @@ array(2) { ["c"]=> string(1) "C" } -Unknown named parameter $d -Cannot use positional argument after named argument +Error: Unknown named parameter $d +Error: Cannot use positional argument after named argument a = A, b = B, c = c a = A, b = B, c = c @@ -68,5 +68,5 @@ array(2) { ["c"]=> string(1) "C" } -Unknown named parameter $d -Cannot use positional argument after named argument +Error: Unknown named parameter $d +Error: Cannot use positional argument after named argument