From 93afd2500dc6e79f9822679c6e79cc751bd8635c Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sun, 16 Aug 2026 17:16:03 +0700 Subject: [PATCH] Zend: applied fixers to improve test robustness (part 2/8) --- Zend/tests/bug47836.phpt | 4 +- Zend/tests/bug49893.phpt | 8 ++-- Zend/tests/bug52041.phpt | 24 +++++----- Zend/tests/bug52355.phpt | 4 +- Zend/tests/bug52614.phpt | 4 +- Zend/tests/bug53432.phpt | 10 ++-- Zend/tests/bug63882.phpt | 4 +- Zend/tests/bug65784.phpt | 4 +- Zend/tests/bug69017.phpt | 4 +- Zend/tests/bug69315.phpt | 24 +++++----- Zend/tests/bug70083.phpt | 4 +- Zend/tests/bug70089.phpt | 16 +++---- Zend/tests/bug70689.phpt | 2 +- Zend/tests/bug70895.phpt | 12 ++--- Zend/tests/bug70898.phpt | 4 +- Zend/tests/bug70914.phpt | 4 +- Zend/tests/bug70918.phpt | 24 +++++----- Zend/tests/bug71196.phpt | 4 +- Zend/tests/bug71572.phpt | 16 +++---- Zend/tests/bug72038.phpt | 8 ++-- Zend/tests/bug72107.phpt | 4 +- Zend/tests/bug74084.phpt | 16 +++---- Zend/tests/bug75218.phpt | 10 ++-- Zend/tests/bug75252.phpt | 8 ++-- Zend/tests/bug75921.phpt | 20 ++++---- Zend/tests/bug76869.phpt | 4 +- Zend/tests/bug78154.phpt | 8 ++-- Zend/tests/bug78182.phpt | 4 +- Zend/tests/bug78531.phpt | 16 +++---- Zend/tests/bug78810.phpt | 8 ++-- Zend/tests/bug78926.phpt | 4 +- Zend/tests/bug79599.phpt | 8 ++-- Zend/tests/bug79947.phpt | 4 +- Zend/tests/bug80972.phpt | 8 ++-- Zend/tests/bug81159.phpt | 8 ++-- Zend/tests/call_to_abstract_method_args.phpt | 8 ++-- .../call_to_deprecated_function_args.phpt | 16 +++---- .../call_user_func_001.phpt | 8 ++-- .../call_user_func_002.phpt | 16 +++---- ...call_user_func_array_array_slice_type.phpt | 4 +- ...er_func_array_array_slice_type_strict.phpt | 8 ++-- .../call_user_func_array_invalid_type.phpt | 4 +- .../call_user_func_by_ref.phpt | 4 +- Zend/tests/callable_param_exception_leak.phpt | 4 +- .../class_name_as_scalar_error_007.phpt | 8 ++-- Zend/tests/class_name/class_on_object.phpt | 4 +- Zend/tests/clone/ast.phpt | 48 +++++++++---------- Zend/tests/closures/bug79778.phpt | 4 +- Zend/tests/closures/closure_015.phpt | 8 ++-- Zend/tests/closures/closure_021.phpt | 4 +- Zend/tests/closures/closure_027.phpt | 4 +- Zend/tests/closures/closure_031.phpt | 2 +- Zend/tests/closures/closure_040.phpt | 4 +- Zend/tests/closures/closure_059.phpt | 12 ++--- Zend/tests/closures/closure_063.phpt | 2 +- .../closures/closure_array_key_error.phpt | 4 +- .../closures/closure_array_offset_error.phpt | 4 +- .../attributes_ast_printing.phpt | 8 ++-- .../closures/closure_from_callable_error.phpt | 30 ++++++------ ...e_from_callable_non_static_statically.phpt | 4 +- Zend/tests/closures/closure_get_current.phpt | 8 ++-- Zend/tests/closures/closure_instantiate.phpt | 6 +-- Zend/tests/closures/closure_write_prop.phpt | 4 +- Zend/tests/coalesce/assign_coalesce_002.phpt | 12 ++--- .../compound_assign_with_numeric_strings.phpt | 15 +++--- Zend/tests/concat/bug81705.phpt | 2 +- Zend/tests/constant_arrays.phpt | 4 +- Zend/tests/constants/008.phpt | 2 +- Zend/tests/constants/018.phpt | 4 +- Zend/tests/constants/bug44827.phpt | 8 ++-- Zend/tests/constants/bug51791.phpt | 4 +- .../constants/dynamic_class_const_fetch.phpt | 22 ++++----- .../dynamic_class_const_fetch_order.phpt | 6 +-- Zend/tests/constants/gh10709.phpt | 2 +- Zend/tests/constants/gh10709_2.phpt | 2 +- .../constant_expressions_exceptions_002.phpt | 4 +- Zend/tests/constexpr/gh7771_3.phpt | 1 - Zend/tests/constexpr/new.phpt | 16 +++---- Zend/tests/constexpr/new_named_params.phpt | 4 +- Zend/tests/constexpr/new_self_parent.phpt | 8 ++-- .../ctor_promotion/ctor_promotion_basic.phpt | 4 +- Zend/tests/div_002.phpt | 4 +- .../div_by_zero_compound_refcounted.phpt | 4 +- .../div_by_zero_compound_with_conversion.phpt | 4 +- Zend/tests/dynamic_call/bug48770_2.phpt | 8 ++-- Zend/tests/dynamic_call/bug48770_3.phpt | 4 +- Zend/tests/dynamic_call/bug68475.phpt | 8 ++-- 87 files changed, 351 insertions(+), 355 deletions(-) diff --git a/Zend/tests/bug47836.phpt b/Zend/tests/bug47836.phpt index 15afc68c48de..1776ad625ffb 100644 --- a/Zend/tests/bug47836.phpt +++ b/Zend/tests/bug47836.phpt @@ -7,13 +7,13 @@ $arr[PHP_INT_MAX] = 1; try { $arr[] = 2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($arr); ?> --EXPECTF-- -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 array(1) { [%d]=> int(1) diff --git a/Zend/tests/bug49893.phpt b/Zend/tests/bug49893.phpt index 0832b0b0ef4c..8dced2673d70 100644 --- a/Zend/tests/bug49893.phpt +++ b/Zend/tests/bug49893.phpt @@ -7,7 +7,7 @@ class A { try { throw new Exception("2"); } catch (Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -21,9 +21,9 @@ class B { try { $b = new B(); } catch(Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -2 -1 +Exception: 2 +Exception: 1 diff --git a/Zend/tests/bug52041.phpt b/Zend/tests/bug52041.phpt index 7debab3f8beb..1ae4642f9496 100644 --- a/Zend/tests/bug52041.phpt +++ b/Zend/tests/bug52041.phpt @@ -9,32 +9,32 @@ function foo() { try { foo()->a = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a->b = 2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a->b++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a += 2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a->b += 2; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } foo()[0] = 1; @@ -48,22 +48,22 @@ var_dump(foo()); ?> --EXPECTF-- Warning: Undefined variable $x in %s on line %d -Attempt to assign property "a" on null +Error: Attempt to assign property "a" on null Warning: Undefined variable $x in %s on line %d -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $x in %s on line %d -Attempt to increment/decrement property "a" on null +Error: Attempt to increment/decrement property "a" on null Warning: Undefined variable $x in %s on line %d -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $x in %s on line %d -Attempt to assign property "a" on null +Error: Attempt to assign property "a" on null Warning: Undefined variable $x in %s on line %d -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $x in %s on line %d diff --git a/Zend/tests/bug52355.phpt b/Zend/tests/bug52355.phpt index 0c207be2beeb..dde6d516d866 100644 --- a/Zend/tests/bug52355.phpt +++ b/Zend/tests/bug52355.phpt @@ -13,7 +13,7 @@ var_dump($foo); try { var_dump(1.0 / -0.0); } catch (\DivisionByZeroError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -21,4 +21,4 @@ try { float(-0) float(-0) float(-0) -Division by zero +DivisionByZeroError: Division by zero diff --git a/Zend/tests/bug52614.phpt b/Zend/tests/bug52614.phpt index 8c2bc0dc9e0e..c0c7a3d4d189 100644 --- a/Zend/tests/bug52614.phpt +++ b/Zend/tests/bug52614.phpt @@ -55,7 +55,7 @@ var_dump($foo->a3); try { $foo->f4()->a = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo->o1); @@ -76,7 +76,7 @@ array(0) { } array(0) { } -Attempt to assign property "a" on null +Error: Attempt to assign property "a" on null NULL object(stdClass)#3 (1) { ["a"]=> diff --git a/Zend/tests/bug53432.phpt b/Zend/tests/bug53432.phpt index aa2a6015f51f..8b37d2a67897 100644 --- a/Zend/tests/bug53432.phpt +++ b/Zend/tests/bug53432.phpt @@ -19,7 +19,7 @@ $str = ''; try { var_dump($str['foo'] = 'a'); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); @@ -27,7 +27,7 @@ $str = ''; try { var_dump($str[] = 'a'); } catch (Error $e) { - echo "Error: {$e->getMessage()}\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); @@ -35,7 +35,7 @@ $str = ''; try { var_dump($str[0] += 1); } catch (Error $e) { - echo "Error: {$e->getMessage()}\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); @@ -43,7 +43,7 @@ $str = ''; try { var_dump($str[0][0] = 'a'); } catch (Error $e) { - echo "Error: {$e->getMessage()}\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); @@ -57,7 +57,7 @@ string(6) " a" Warning: Illegal string offset -1 in %s on line %d NULL string(0) "" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(0) "" Error: [] operator not supported for strings string(0) "" diff --git a/Zend/tests/bug63882.phpt b/Zend/tests/bug63882.phpt index 801f1b1e07ea..53b62e9937b4 100644 --- a/Zend/tests/bug63882.phpt +++ b/Zend/tests/bug63882.phpt @@ -12,9 +12,9 @@ $testobj2->x = $testobj2; try { var_dump($testobj1 == $testobj2); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Nesting level too deep - recursive dependency? +Error: Nesting level too deep - recursive dependency? diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt index 78a7cd12d90c..1ef513b109e1 100644 --- a/Zend/tests/bug65784.phpt +++ b/Zend/tests/bug65784.phpt @@ -18,7 +18,7 @@ try { var_dump($foo); } catch (Exception $e) { do { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } while ($e = $e->getPrevious()); } @@ -55,7 +55,7 @@ function foo3() { $bar = foo3(); ?> --EXPECTF-- -string(9) "not catch" +Exception: not catch NULL Fatal error: Uncaught Exception: not caught in %sbug65784.php:42 diff --git a/Zend/tests/bug69017.phpt b/Zend/tests/bug69017.phpt index d1608ebbf9db..a527b1748a5c 100644 --- a/Zend/tests/bug69017.phpt +++ b/Zend/tests/bug69017.phpt @@ -19,7 +19,7 @@ c1::$a2[] = 1; try { c1::$a3[] = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(c1::$a1); @@ -27,7 +27,7 @@ var_dump(c1::$a2); var_dump(c1::$a3); ?> --EXPECTF-- -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 array(2) { [1]=> string(3) "one" diff --git a/Zend/tests/bug69315.phpt b/Zend/tests/bug69315.phpt index 82017c055241..c5aa58d8c1bf 100644 --- a/Zend/tests/bug69315.phpt +++ b/Zend/tests/bug69315.phpt @@ -10,41 +10,41 @@ var_dump(is_callable("strlen")); try { var_dump(strlen("xxx")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(defined("PHP_VERSION")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(constant("PHP_VERSION")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(call_user_func("strlen")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(is_string("xxx")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(is_string()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(false) bool(false) -Call to undefined function strlen() -Call to undefined function defined() -Call to undefined function constant() -Call to undefined function call_user_func() -Call to undefined function is_string() -Call to undefined function is_string() +Error: Call to undefined function strlen() +Error: Call to undefined function defined() +Error: Call to undefined function constant() +Error: Call to undefined function call_user_func() +Error: Call to undefined function is_string() +Error: Call to undefined function is_string() diff --git a/Zend/tests/bug70083.phpt b/Zend/tests/bug70083.phpt index 691e6a412510..ed3a4b9e0f5b 100644 --- a/Zend/tests/bug70083.phpt +++ b/Zend/tests/bug70083.phpt @@ -16,13 +16,13 @@ $foo = new foo; try { $foo->i = &noref(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); ?> --EXPECT-- -Cannot assign by reference to overloaded object +Error: Cannot assign by reference to overloaded object object(foo)#1 (1) { ["var":"foo":private]=> NULL diff --git a/Zend/tests/bug70089.phpt b/Zend/tests/bug70089.phpt index 3a8e7d8e783e..72b0563b202b 100644 --- a/Zend/tests/bug70089.phpt +++ b/Zend/tests/bug70089.phpt @@ -8,28 +8,28 @@ function dummy($a) { try { chr(0)[0][] = 1; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset(chr(0)[0][0]); } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } eval("function runtimetest(&\$a) {} "); try { runtimetest(chr(0)[0]); } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ++chr(0)[0]; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(36) "Cannot use string offset as an array" -string(36) "Cannot use string offset as an array" -string(47) "Cannot create references to/from string offsets" -string(41) "Cannot increment/decrement string offsets" +Error: Cannot use string offset as an array +Error: Cannot use string offset as an array +Error: Cannot create references to/from string offsets +Error: Cannot increment/decrement string offsets diff --git a/Zend/tests/bug70689.phpt b/Zend/tests/bug70689.phpt index d1895cf39e54..3ea7844b13ba 100644 --- a/Zend/tests/bug70689.phpt +++ b/Zend/tests/bug70689.phpt @@ -14,7 +14,7 @@ set_error_handler(function($errno, $errstr) { try { foo(); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/bug70895.phpt b/Zend/tests/bug70895.phpt index afbea1c91d76..d661c1c259fc 100644 --- a/Zend/tests/bug70895.phpt +++ b/Zend/tests/bug70895.phpt @@ -6,20 +6,20 @@ Bug #70895 null ptr deref and segfault with crafted callable try { array_map("%n", 0); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_map("%n %i", 0); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_map("%n %i aoeu %f aoeu %p", 0); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n" not found or invalid function name -array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i" not found or invalid function name -array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i aoeu %f aoeu %p" not found or invalid function name +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n" not found or invalid function name +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i" not found or invalid function name +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i aoeu %f aoeu %p" not found or invalid function name diff --git a/Zend/tests/bug70898.phpt b/Zend/tests/bug70898.phpt index d3d2cf79a9d1..f2426f6c1ac4 100644 --- a/Zend/tests/bug70898.phpt +++ b/Zend/tests/bug70898.phpt @@ -9,8 +9,8 @@ function m($f,$a){ try { echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",(""))))))); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -array_map(): Argument #1 ($callback) must be a valid callback or null, function "0000000000000000000000000000000000" not found or invalid function name +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, function "0000000000000000000000000000000000" not found or invalid function name diff --git a/Zend/tests/bug70914.phpt b/Zend/tests/bug70914.phpt index 73a43a5600dc..db4609f31bec 100644 --- a/Zend/tests/bug70914.phpt +++ b/Zend/tests/bug70914.phpt @@ -10,8 +10,8 @@ $st = $db->query('SELECT 1'); try { $re = $st->fetchObject('%Z'); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -PDOStatement::fetchObject(): Argument #1 ($class) must be a valid class name, %Z given +TypeError: PDOStatement::fetchObject(): Argument #1 ($class) must be a valid class name, %Z given diff --git a/Zend/tests/bug70918.phpt b/Zend/tests/bug70918.phpt index 54f3a3c72a80..7d521b631ead 100644 --- a/Zend/tests/bug70918.phpt +++ b/Zend/tests/bug70918.phpt @@ -5,43 +5,43 @@ Bug #70918 (Segfault using static outside of class scope) try { static::x; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { parent::x; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { self::x; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new static; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { static::x(); } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { static::$i; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(52) "Cannot access "static" when no class scope is active" -string(52) "Cannot access "parent" when no class scope is active" -string(50) "Cannot access "self" when no class scope is active" -string(52) "Cannot access "static" when no class scope is active" -string(52) "Cannot access "static" when no class scope is active" -string(52) "Cannot access "static" when no class scope is active" +Error: Cannot access "static" when no class scope is active +Error: Cannot access "parent" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "static" when no class scope is active +Error: Cannot access "static" when no class scope is active +Error: Cannot access "static" when no class scope is active diff --git a/Zend/tests/bug71196.phpt b/Zend/tests/bug71196.phpt index ca25f9f4fcba..511f8ac2d8ca 100644 --- a/Zend/tests/bug71196.phpt +++ b/Zend/tests/bug71196.phpt @@ -6,8 +6,8 @@ try { $a = "1"; [1, (y().$a.$a) . ($a.$a)]; } catch (Error $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(30) "Call to undefined function y()" +Error: Call to undefined function y() diff --git a/Zend/tests/bug71572.phpt b/Zend/tests/bug71572.phpt index f4079e55f89a..af7df9a2ca7b 100644 --- a/Zend/tests/bug71572.phpt +++ b/Zend/tests/bug71572.phpt @@ -7,28 +7,28 @@ $str = "abc"; try { var_dump($str[0] = ""); } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($str[1] = ""); } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($str[3] = ""); } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($str[10] = ""); } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); ?> --EXPECT-- -Cannot assign an empty string to a string offset -Cannot assign an empty string to a string offset -Cannot assign an empty string to a string offset -Cannot assign an empty string to a string offset +Error: Cannot assign an empty string to a string offset +Error: Cannot assign an empty string to a string offset +Error: Cannot assign an empty string to a string offset +Error: Cannot assign an empty string to a string offset string(3) "abc" diff --git a/Zend/tests/bug72038.phpt b/Zend/tests/bug72038.phpt index f5491f1b9d6f..25e00463eeb3 100644 --- a/Zend/tests/bug72038.phpt +++ b/Zend/tests/bug72038.phpt @@ -7,13 +7,13 @@ try { test($foo = new stdClass); var_dump($foo); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test($bar = 2); var_dump($bar); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } test($baz = &$bar); @@ -25,6 +25,6 @@ function test(&$param) { ?> --EXPECT-- -test(): Argument #1 ($param) could not be passed by reference -test(): Argument #1 ($param) could not be passed by reference +Error: test(): Argument #1 ($param) could not be passed by reference +Error: test(): Argument #1 ($param) could not be passed by reference int(1) diff --git a/Zend/tests/bug72107.phpt b/Zend/tests/bug72107.phpt index f65b1422691f..02fefe247e99 100644 --- a/Zend/tests/bug72107.phpt +++ b/Zend/tests/bug72107.phpt @@ -9,8 +9,8 @@ function test($a) { try { test(1); } catch (\Error $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -func_get_args() expects exactly 0 arguments, 4 given +ArgumentCountError: func_get_args() expects exactly 0 arguments, 4 given diff --git a/Zend/tests/bug74084.phpt b/Zend/tests/bug74084.phpt index 36239438c689..b73add39ef5d 100644 --- a/Zend/tests/bug74084.phpt +++ b/Zend/tests/bug74084.phpt @@ -9,29 +9,29 @@ unset($$A); try { $$A -= $$B['a'] = &$$C; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($$A); try { $$A *= $$B['a'] = &$$C; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($$A); try { $$A /= $$B['a'] = &$$C; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($$A); try { $$A **= $$B['a'] = &$$C; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: array - array -Unsupported operand types: array * array -Unsupported operand types: array / array -Unsupported operand types: array ** array +TypeError: Unsupported operand types: array - array +TypeError: Unsupported operand types: array * array +TypeError: Unsupported operand types: array / array +TypeError: Unsupported operand types: array ** array diff --git a/Zend/tests/bug75218.phpt b/Zend/tests/bug75218.phpt index ddbde62a5269..f9d7e7ebf1f0 100644 --- a/Zend/tests/bug75218.phpt +++ b/Zend/tests/bug75218.phpt @@ -7,7 +7,7 @@ function try_eval($code) { try { eval($code); } catch (CompileError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -18,7 +18,7 @@ try_eval('declare(encoding=[]);'); ?> --EXPECT-- -Multiple final modifiers are not allowed -Multiple access type modifiers are not allowed -__HALT_COMPILER() can only be used from the outermost scope -Encoding must be a literal +CompileError: Multiple final modifiers are not allowed +CompileError: Multiple access type modifiers are not allowed +CompileError: __HALT_COMPILER() can only be used from the outermost scope +CompileError: Encoding must be a literal diff --git a/Zend/tests/bug75252.phpt b/Zend/tests/bug75252.phpt index b4e0a1b5bdc3..36c04a6bc976 100644 --- a/Zend/tests/bug75252.phpt +++ b/Zend/tests/bug75252.phpt @@ -13,16 +13,16 @@ CODE; try { eval($code); } catch (ParseError $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { eval($code); } catch (ParseError $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(41) "syntax error, unexpected identifier "FOO"" -string(41) "syntax error, unexpected identifier "FOO"" +ParseError: syntax error, unexpected identifier "FOO" +ParseError: syntax error, unexpected identifier "FOO" diff --git a/Zend/tests/bug75921.phpt b/Zend/tests/bug75921.phpt index ab82c85840c4..925236104e87 100644 --- a/Zend/tests/bug75921.phpt +++ b/Zend/tests/bug75921.phpt @@ -6,7 +6,7 @@ Bug #75921: Inconsistent error when creating stdObject from empty variable try { $null->a = 42; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); @@ -14,7 +14,7 @@ unset($null); try { $null->a['hello'] = 42; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); @@ -22,7 +22,7 @@ unset($null); try { $null->a->b = 42; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); @@ -30,7 +30,7 @@ unset($null); try { $null->a['hello']->b = 42; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); @@ -38,30 +38,30 @@ unset($null); try { $null->a->b['hello'] = 42; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); ?> --EXPECTF-- -Attempt to assign property "a" on null +Error: Attempt to assign property "a" on null Warning: Undefined variable $null in %s on line %d NULL -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $null in %s on line %d NULL -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $null in %s on line %d NULL -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $null in %s on line %d NULL -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null Warning: Undefined variable $null in %s on line %d NULL diff --git a/Zend/tests/bug76869.phpt b/Zend/tests/bug76869.phpt index a19d2dfedbfe..afd60595970b 100644 --- a/Zend/tests/bug76869.phpt +++ b/Zend/tests/bug76869.phpt @@ -16,8 +16,8 @@ $b = new B(); try { var_dump($b->f()); } catch (Throwable $e) { - echo "Exception: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Call to protected method B::f() from global scope +Error: Call to protected method B::f() from global scope diff --git a/Zend/tests/bug78154.phpt b/Zend/tests/bug78154.phpt index 94f49b224e6d..3ce187a865f5 100644 --- a/Zend/tests/bug78154.phpt +++ b/Zend/tests/bug78154.phpt @@ -8,7 +8,7 @@ namespace { var_dump(similar_text('a', 'a', $c=0x44444444)); var_dump($c); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } namespace Foo { @@ -16,11 +16,11 @@ namespace Foo { var_dump(similar_text('a', 'a', $d=0x44444444)); var_dump($d); } catch (\Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Exception: similar_text(): Argument #3 ($percent) could not be passed by reference -Exception: similar_text(): Argument #3 ($percent) could not be passed by reference +Error: similar_text(): Argument #3 ($percent) could not be passed by reference +Error: similar_text(): Argument #3 ($percent) could not be passed by reference diff --git a/Zend/tests/bug78182.phpt b/Zend/tests/bug78182.phpt index a751e953bbff..b7f9fe9b7195 100644 --- a/Zend/tests/bug78182.phpt +++ b/Zend/tests/bug78182.phpt @@ -7,10 +7,10 @@ $propName = 'prop'; try { $$varName->$propName =& $$varName; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($var); ?> --EXPECT-- -Attempt to modify property "prop" on null +Error: Attempt to modify property "prop" on null NULL diff --git a/Zend/tests/bug78531.phpt b/Zend/tests/bug78531.phpt index b818afb79a86..23a5388d6b5d 100644 --- a/Zend/tests/bug78531.phpt +++ b/Zend/tests/bug78531.phpt @@ -5,33 +5,33 @@ Bug #78531 (Crash when using undefined variable as object) try { $u1->a += 5; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = ++$u2->a; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = $u3->a++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $u4->a->a += 5; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $u1 in %s on line %d -Attempt to assign property "a" on null +Error: Attempt to assign property "a" on null Warning: Undefined variable $u2 in %s on line %d -Attempt to increment/decrement property "a" on null +Error: Attempt to increment/decrement property "a" on null Warning: Undefined variable $u3 in %s on line %d -Attempt to increment/decrement property "a" on null +Error: Attempt to increment/decrement property "a" on null Warning: Undefined variable $u4 in %s on line %d -Attempt to modify property "a" on null +Error: Attempt to modify property "a" on null diff --git a/Zend/tests/bug78810.phpt b/Zend/tests/bug78810.phpt index 0fd56f0ceda5..4952c562c936 100644 --- a/Zend/tests/bug78810.phpt +++ b/Zend/tests/bug78810.phpt @@ -11,15 +11,15 @@ $test = new Test; try { $test->i++; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->i += 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Typed property Test::$i must not be accessed before initialization -Typed property Test::$i must not be accessed before initialization +Error: Typed property Test::$i must not be accessed before initialization +Error: Typed property Test::$i must not be accessed before initialization diff --git a/Zend/tests/bug78926.phpt b/Zend/tests/bug78926.phpt index a59692748b2d..6b44ff58e7ed 100644 --- a/Zend/tests/bug78926.phpt +++ b/Zend/tests/bug78926.phpt @@ -12,11 +12,11 @@ spl_autoload_register(function($class) { try { class B extends A {} } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(class_exists('B', false)); ?> --EXPECT-- -Class "A" not found +Error: Class "A" not found bool(false) diff --git a/Zend/tests/bug79599.phpt b/Zend/tests/bug79599.phpt index 57e5332431f5..32e65087c2c3 100644 --- a/Zend/tests/bug79599.phpt +++ b/Zend/tests/bug79599.phpt @@ -14,14 +14,14 @@ function test2(){ try{ test1(); }catch(\Exception $e){ - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try{ test2(); }catch(\Exception $e){ - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(21) "Undefined variable $b" -string(21) "Undefined variable $c" +Exception: Undefined variable $b +Exception: Undefined variable $c diff --git a/Zend/tests/bug79947.phpt b/Zend/tests/bug79947.phpt index 0593eacfd6c4..457c0603671b 100644 --- a/Zend/tests/bug79947.phpt +++ b/Zend/tests/bug79947.phpt @@ -7,11 +7,11 @@ $key = []; try { $array[$key] += [$key]; } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($array); ?> --EXPECT-- -Cannot access offset of type array on array +TypeError: Cannot access offset of type array on array array(0) { } diff --git a/Zend/tests/bug80972.phpt b/Zend/tests/bug80972.phpt index 01d1a98952da..53bcf3b75559 100644 --- a/Zend/tests/bug80972.phpt +++ b/Zend/tests/bug80972.phpt @@ -20,7 +20,7 @@ try { $string[(string) 10e120] = 'E'; var_dump($string); } catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } /* This same bug also permits to modify the first byte of a string even if @@ -29,13 +29,13 @@ try { /* This must not affect the string value */ $string["wrong"] = "f"; } catch (\Throwable $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($string); ?> --EXPECT-- Float casted to string compile -Cannot access offset of type string on string -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(34) "Here is some text for good measure" diff --git a/Zend/tests/bug81159.phpt b/Zend/tests/bug81159.phpt index d16deafbf5b9..54a85a160122 100644 --- a/Zend/tests/bug81159.phpt +++ b/Zend/tests/bug81159.phpt @@ -8,14 +8,14 @@ $o = new stdClass(); try { $s[$o] = 'A'; } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($s[$o]); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access offset of type stdClass on string -Cannot access offset of type stdClass on string +TypeError: Cannot access offset of type stdClass on string +TypeError: Cannot access offset of type stdClass on string diff --git a/Zend/tests/call_to_abstract_method_args.phpt b/Zend/tests/call_to_abstract_method_args.phpt index cbbc276d2ce2..c5c6dc67d88d 100644 --- a/Zend/tests/call_to_abstract_method_args.phpt +++ b/Zend/tests/call_to_abstract_method_args.phpt @@ -10,17 +10,17 @@ abstract class Test { try { Test::method(new stdClass); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = new stdClass; try { $ret = Test::method(new stdClass); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot call abstract method Test::method() -Cannot call abstract method Test::method() +Error: Cannot call abstract method Test::method() +Error: Cannot call abstract method Test::method() diff --git a/Zend/tests/call_to_deprecated_function_args.phpt b/Zend/tests/call_to_deprecated_function_args.phpt index bbae74746080..7574bbffbee4 100644 --- a/Zend/tests/call_to_deprecated_function_args.phpt +++ b/Zend/tests/call_to_deprecated_function_args.phpt @@ -12,21 +12,21 @@ set_error_handler(function($code, $msg) { try { zend_test_deprecated(new stdClass); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = new stdClass; try { $ret = zend_test_deprecated(new stdClass()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $fn = 'zend_test_deprecated'; $fn(new stdClass); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = new stdClass; @@ -34,12 +34,12 @@ try { $fn = 'zend_test_deprecated'; $ret = $fn(new stdClass); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Function zend_test_deprecated() is deprecated -Function zend_test_deprecated() is deprecated -Function zend_test_deprecated() is deprecated -Function zend_test_deprecated() is deprecated +Error: Function zend_test_deprecated() is deprecated +Error: Function zend_test_deprecated() is deprecated +Error: Function zend_test_deprecated() is deprecated +Error: Function zend_test_deprecated() is deprecated diff --git a/Zend/tests/call_user_functions/call_user_func_001.phpt b/Zend/tests/call_user_functions/call_user_func_001.phpt index 9497d305e2cd..46203b279dde 100644 --- a/Zend/tests/call_user_functions/call_user_func_001.phpt +++ b/Zend/tests/call_user_functions/call_user_func_001.phpt @@ -25,17 +25,17 @@ namespace testing { try { call_user_func(array(new $class, 'priv'), 'foobar'); } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array(new $class, 'prot'), 'foobar'); } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- string(6) "foobar" -call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access private method testing\foo::priv() -call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access protected method testing\foo::prot() +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access private method testing\foo::priv() +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access protected method testing\foo::prot() diff --git a/Zend/tests/call_user_functions/call_user_func_002.phpt b/Zend/tests/call_user_functions/call_user_func_002.phpt index 443334cd2375..9e739610eb60 100644 --- a/Zend/tests/call_user_functions/call_user_func_002.phpt +++ b/Zend/tests/call_user_functions/call_user_func_002.phpt @@ -10,32 +10,32 @@ spl_autoload_register(function ($class) { try { call_user_func(array('foo', 'bar')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array('', 'bar')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array($foo, 'bar')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array($foo, '')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- string(3) "foo" -call_user_func(): Argument #1 ($callback) must be a valid callback, class "foo" not found -call_user_func(): Argument #1 ($callback) must be a valid callback, class "" not found +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class "foo" not found +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class "" not found Warning: Undefined variable $foo in %s on line %d -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 Warning: Undefined variable $foo in %s on line %d -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/call_user_functions/call_user_func_array_array_slice_type.phpt b/Zend/tests/call_user_functions/call_user_func_array_array_slice_type.phpt index 1849d8fc19bc..31cb8626b5d4 100644 --- a/Zend/tests/call_user_functions/call_user_func_array_array_slice_type.phpt +++ b/Zend/tests/call_user_functions/call_user_func_array_array_slice_type.phpt @@ -9,7 +9,7 @@ try { $len = []; call_user_func_array('var_dump', array_slice($array, 0, $len)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $len = 2.0; @@ -20,7 +20,7 @@ call_user_func_array('var_dump', array_slice($array, 1, $len)); ?> --EXPECT-- -array_slice(): Argument #3 ($length) must be of type ?int, array given +TypeError: array_slice(): Argument #3 ($length) must be of type ?int, array given int(1) int(2) int(2) diff --git a/Zend/tests/call_user_functions/call_user_func_array_array_slice_type_strict.phpt b/Zend/tests/call_user_functions/call_user_func_array_array_slice_type_strict.phpt index f73c8bbb2467..c45f966e564f 100644 --- a/Zend/tests/call_user_functions/call_user_func_array_array_slice_type_strict.phpt +++ b/Zend/tests/call_user_functions/call_user_func_array_array_slice_type_strict.phpt @@ -10,14 +10,14 @@ try { $len = []; call_user_func_array('var_dump', array_slice($array, 0, $len)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $len = 2.0; call_user_func_array('var_dump', array_slice($array, 0, $len)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $len = null; @@ -25,7 +25,7 @@ call_user_func_array('var_dump', array_slice($array, 1, $len)); ?> --EXPECT-- -array_slice(): Argument #3 ($length) must be of type ?int, array given -array_slice(): Argument #3 ($length) must be of type ?int, float given +TypeError: array_slice(): Argument #3 ($length) must be of type ?int, array given +TypeError: array_slice(): Argument #3 ($length) must be of type ?int, float given int(2) int(3) diff --git a/Zend/tests/call_user_functions/call_user_func_array_invalid_type.phpt b/Zend/tests/call_user_functions/call_user_func_array_invalid_type.phpt index 785a6e35e907..7a748acff546 100644 --- a/Zend/tests/call_user_functions/call_user_func_array_invalid_type.phpt +++ b/Zend/tests/call_user_functions/call_user_func_array_invalid_type.phpt @@ -11,8 +11,8 @@ $drv = new drv; try { call_user_func_array(array($drv, 'func'), null); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -call_user_func_array(): Argument #2 ($args) must be of type array, null given +TypeError: call_user_func_array(): Argument #2 ($args) must be of type array, null given diff --git a/Zend/tests/call_user_functions/call_user_func_by_ref.phpt b/Zend/tests/call_user_functions/call_user_func_by_ref.phpt index 4596269549a1..c94ddda854ea 100644 --- a/Zend/tests/call_user_functions/call_user_func_by_ref.phpt +++ b/Zend/tests/call_user_functions/call_user_func_by_ref.phpt @@ -8,10 +8,10 @@ function test(Type &$ref) { try { call_user_func('test', 0); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: test(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d -test(): Argument #1 ($ref) must be of type Type, int given, called in %s on line %d +TypeError: test(): Argument #1 ($ref) must be of type Type, int given, called in %s on line %d diff --git a/Zend/tests/callable_param_exception_leak.phpt b/Zend/tests/callable_param_exception_leak.phpt index 090279971080..010cc8bb38a2 100644 --- a/Zend/tests/callable_param_exception_leak.phpt +++ b/Zend/tests/callable_param_exception_leak.phpt @@ -8,8 +8,8 @@ spl_autoload_register(function ($class) { try { array_map('A::b', []); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Failed +Exception: Failed diff --git a/Zend/tests/class_name/class_name_as_scalar_error_007.phpt b/Zend/tests/class_name/class_name_as_scalar_error_007.phpt index a550cdd2b06d..4b2dca548399 100644 --- a/Zend/tests/class_name/class_name_as_scalar_error_007.phpt +++ b/Zend/tests/class_name/class_name_as_scalar_error_007.phpt @@ -6,15 +6,15 @@ Cannot access self::class when no class scope is active try { var_dump(self::class); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump([self::class]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot use "self" in the global scope -Cannot use "self" in the global scope +Error: Cannot use "self" in the global scope +Error: Cannot use "self" in the global scope diff --git a/Zend/tests/class_name/class_on_object.phpt b/Zend/tests/class_name/class_on_object.phpt index dab09872901b..d5a48fb62246 100644 --- a/Zend/tests/class_name/class_on_object.phpt +++ b/Zend/tests/class_name/class_on_object.phpt @@ -17,7 +17,7 @@ function test() { try { test(); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -25,4 +25,4 @@ try { string(8) "stdClass" string(8) "stdClass" string(8) "stdClass" -Cannot use "::class" on null +TypeError: Cannot use "::class" on null diff --git a/Zend/tests/clone/ast.phpt b/Zend/tests/clone/ast.phpt index e482854a9448..a8c11a43f881 100644 --- a/Zend/tests/clone/ast.phpt +++ b/Zend/tests/clone/ast.phpt @@ -9,86 +9,86 @@ $x = new stdClass(); try { assert(false && $y = clone $x); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x)); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, )); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, [ "foo" => $foo, "bar" => $bar ])); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, $array)); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, $array, $extraParameter, $trailingComma, )); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(object: $x, withProperties: [ "foo" => $foo, "bar" => $bar ])); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, withProperties: [ "foo" => $foo, "bar" => $bar ])); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(object: $x)); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(object: $x, [ "foo" => $foo, "bar" => $bar ])); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(...["object" => $x, "withProperties" => [ "foo" => $foo, "bar" => $bar ]])); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(...)); } catch (Error $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && ($y = \clone($x))) -assert(false && ($y = \clone($x))) -assert(false && ($y = \clone($x))) -assert(false && ($y = \clone($x, ['foo' => $foo, 'bar' => $bar]))) -assert(false && ($y = \clone($x, $array))) -assert(false && ($y = \clone($x, $array, $extraParameter, $trailingComma))) -assert(false && ($y = \clone(object: $x, withProperties: ['foo' => $foo, 'bar' => $bar]))) -assert(false && ($y = \clone($x, withProperties: ['foo' => $foo, 'bar' => $bar]))) -assert(false && ($y = \clone(object: $x))) -assert(false && ($y = \clone(object: $x, ['foo' => $foo, 'bar' => $bar]))) -assert(false && ($y = \clone(...['object' => $x, 'withProperties' => ['foo' => $foo, 'bar' => $bar]]))) -assert(false && ($y = \clone(...))) +AssertionError: assert(false && ($y = \clone($x))) +AssertionError: assert(false && ($y = \clone($x))) +AssertionError: assert(false && ($y = \clone($x))) +AssertionError: assert(false && ($y = \clone($x, ['foo' => $foo, 'bar' => $bar]))) +AssertionError: assert(false && ($y = \clone($x, $array))) +AssertionError: assert(false && ($y = \clone($x, $array, $extraParameter, $trailingComma))) +AssertionError: assert(false && ($y = \clone(object: $x, withProperties: ['foo' => $foo, 'bar' => $bar]))) +AssertionError: assert(false && ($y = \clone($x, withProperties: ['foo' => $foo, 'bar' => $bar]))) +AssertionError: assert(false && ($y = \clone(object: $x))) +AssertionError: assert(false && ($y = \clone(object: $x, ['foo' => $foo, 'bar' => $bar]))) +AssertionError: assert(false && ($y = \clone(...['object' => $x, 'withProperties' => ['foo' => $foo, 'bar' => $bar]]))) +AssertionError: assert(false && ($y = \clone(...))) diff --git a/Zend/tests/closures/bug79778.phpt b/Zend/tests/closures/bug79778.phpt index fa2e2771dcec..8ed00d1cac33 100644 --- a/Zend/tests/closures/bug79778.phpt +++ b/Zend/tests/closures/bug79778.phpt @@ -12,7 +12,7 @@ print_r($closure1); try { $closure1(); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($closure1); @@ -49,7 +49,7 @@ Closure Object ) ) -Undefined constant "CONST_REF" +Error: Undefined constant "CONST_REF" object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" diff --git a/Zend/tests/closures/closure_015.phpt b/Zend/tests/closures/closure_015.phpt index f6903ebdb183..4e89471fbff2 100644 --- a/Zend/tests/closures/closure_015.phpt +++ b/Zend/tests/closures/closure_015.phpt @@ -7,15 +7,15 @@ $x = function() { return 1; }; try { print (string) $x; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { print $x; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Object of class Closure could not be converted to string -Object of class Closure could not be converted to string +Error: Object of class Closure could not be converted to string +Error: Object of class Closure could not be converted to string diff --git a/Zend/tests/closures/closure_021.phpt b/Zend/tests/closures/closure_021.phpt index 95ff7d889f9e..d9a23bbf2e4a 100644 --- a/Zend/tests/closures/closure_021.phpt +++ b/Zend/tests/closures/closure_021.phpt @@ -14,9 +14,9 @@ $foo = function() { try { $foo(); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(5) "test!" +Exception: test! diff --git a/Zend/tests/closures/closure_027.phpt b/Zend/tests/closures/closure_027.phpt index 6e467856100a..8e5a53a67921 100644 --- a/Zend/tests/closures/closure_027.phpt +++ b/Zend/tests/closures/closure_027.phpt @@ -16,7 +16,7 @@ $a = function($x) use ($y) {}; try { test($a); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } test(new stdclass); @@ -28,7 +28,7 @@ object(stdClass)#%d (0) { NULL Warning: Undefined variable $y in %s on line %d -Exception: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected +ArgumentCountError: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected Fatal error: Uncaught TypeError: test(): Argument #1 ($a) must be of type Closure, stdClass given, called in %s:%d Stack trace: diff --git a/Zend/tests/closures/closure_031.phpt b/Zend/tests/closures/closure_031.phpt index 19f3dc6e3212..611cf9a62352 100644 --- a/Zend/tests/closures/closure_031.phpt +++ b/Zend/tests/closures/closure_031.phpt @@ -11,7 +11,7 @@ $foo = function() { try { var_dump($foo->a); } catch (Error $ex) { - echo "Error: {$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/closures/closure_040.phpt b/Zend/tests/closures/closure_040.phpt index b733bdbef053..f265ceb7ef6a 100644 --- a/Zend/tests/closures/closure_040.phpt +++ b/Zend/tests/closures/closure_040.phpt @@ -27,13 +27,13 @@ $cas = $a->getStaticIncrementor(); try { $ca->bindTo($a, array()); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $cas->bindTo($a, 'A'); ?> --EXPECTF-- -Closure::bindTo(): Argument #2 ($newScope) must be of type object|string|null, array given +TypeError: Closure::bindTo(): Argument #2 ($newScope) must be of type object|string|null, array given Warning: Cannot bind an instance to a static closure, this will be an error in PHP 9 in %s on line %d diff --git a/Zend/tests/closures/closure_059.phpt b/Zend/tests/closures/closure_059.phpt index d8f7590db902..d101d4ab2720 100644 --- a/Zend/tests/closures/closure_059.phpt +++ b/Zend/tests/closures/closure_059.phpt @@ -20,20 +20,20 @@ call_user_func(array($f,"__invoke"), $a); try { $f($b); } catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f->__invoke($b); } catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array($f,"__invoke"), $b); } catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Exception: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given, called in %s on line %d -Exception: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given -Exception: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given +TypeError: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given +TypeError: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given diff --git a/Zend/tests/closures/closure_063.phpt b/Zend/tests/closures/closure_063.phpt index b53f370eb4bf..f46cdd976c88 100644 --- a/Zend/tests/closures/closure_063.phpt +++ b/Zend/tests/closures/closure_063.phpt @@ -9,4 +9,4 @@ Closure::fromCallable('foo')->bindTo(new stdClass); ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/Zend/tests/closures/closure_array_key_error.phpt b/Zend/tests/closures/closure_array_key_error.phpt index 8b6441e3c25a..6a21331fa99c 100644 --- a/Zend/tests/closures/closure_array_key_error.phpt +++ b/Zend/tests/closures/closure_array_key_error.phpt @@ -6,9 +6,9 @@ Trying to use lambda as array key try { var_dump(array(function() { } => 1)); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access offset of type Closure on array +TypeError: Cannot access offset of type Closure on array diff --git a/Zend/tests/closures/closure_array_offset_error.phpt b/Zend/tests/closures/closure_array_offset_error.phpt index 8958237b0eb8..d6cfe3a71bb2 100644 --- a/Zend/tests/closures/closure_array_offset_error.phpt +++ b/Zend/tests/closures/closure_array_offset_error.phpt @@ -6,9 +6,9 @@ Trying to use lambda in array offset try { $test[function(){}] = 1; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access offset of type Closure on array +TypeError: Cannot access offset of type Closure on array diff --git a/Zend/tests/closures/closure_const_expr/attributes_ast_printing.phpt b/Zend/tests/closures/closure_const_expr/attributes_ast_printing.phpt index e87abf8c9061..d5226ee597b0 100644 --- a/Zend/tests/closures/closure_const_expr/attributes_ast_printing.phpt +++ b/Zend/tests/closures/closure_const_expr/attributes_ast_printing.phpt @@ -14,7 +14,7 @@ try { function () { } ); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -26,16 +26,16 @@ try { class {} ); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(!#[Attr(static function ($foo) { +AssertionError: assert(!#[Attr(static function ($foo) { echo $foo; })] function () { }) -assert(!new #[Attr(static function ($foo) { +AssertionError: assert(!new #[Attr(static function ($foo) { echo $foo; })] class { }) diff --git a/Zend/tests/closures/closure_from_callable_error.phpt b/Zend/tests/closures/closure_from_callable_error.phpt index c6fd1ff831f5..5d14ee396220 100644 --- a/Zend/tests/closures/closure_from_callable_error.phpt +++ b/Zend/tests/closures/closure_from_callable_error.phpt @@ -14,7 +14,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } @@ -27,7 +27,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Cannot access privateInstance method'."\n"; @@ -39,7 +39,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'SubClass cannot access private instance method'."\n"; @@ -51,7 +51,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Cannot access private static function of instance'."\n"; @@ -63,7 +63,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Cannot access private static method statically'."\n"; @@ -75,7 +75,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Cannot access private static method statically with colon scheme'."\n"; @@ -87,7 +87,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Non-existent method should fail'."\n"; @@ -99,7 +99,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Non-existent class should fail'."\n"; @@ -111,7 +111,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Non-existent function should fail'."\n"; @@ -123,7 +123,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } @@ -137,7 +137,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Subclass cannot closure over parent private static method'."\n"; @@ -150,7 +150,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Function scope cannot closure over protected instance method'."\n"; @@ -162,7 +162,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Function scope cannot closure over private instance method'."\n"; @@ -174,7 +174,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo 'Access private instance method of parent object through "self::" to parent method'."\n"; @@ -187,7 +187,7 @@ catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { - echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; + echo 'Wrong exception type thrown: ', $t::class, ': ', $t->getMessage(), "\n"; } echo "OK\n"; diff --git a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt index 24df1d186a43..b93372074dee 100644 --- a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt +++ b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt @@ -12,9 +12,9 @@ try { $fn = Closure::fromCallable(['A', 'method']); $fn(); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Failed to create closure from callable: non-static method A::method() cannot be called statically +TypeError: Failed to create closure from callable: non-static method A::method() cannot be called statically diff --git a/Zend/tests/closures/closure_get_current.phpt b/Zend/tests/closures/closure_get_current.phpt index 3024ff355b55..df58f69cd723 100644 --- a/Zend/tests/closures/closure_get_current.phpt +++ b/Zend/tests/closures/closure_get_current.phpt @@ -24,7 +24,7 @@ function fail() { try { fail(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } function foo() { @@ -34,7 +34,7 @@ function foo() { try { foo(...)(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -60,5 +60,5 @@ int(9) int(10) int(10) int(11) -Current function is not a closure -Current function is not a closure +Error: Current function is not a closure +Error: Current function is not a closure diff --git a/Zend/tests/closures/closure_instantiate.phpt b/Zend/tests/closures/closure_instantiate.phpt index de3b866cb82e..566720051ef8 100644 --- a/Zend/tests/closures/closure_instantiate.phpt +++ b/Zend/tests/closures/closure_instantiate.phpt @@ -10,12 +10,12 @@ try { $x = new Closure(); } catch (Exception $e) { // Instantiating a closure is an error, not an exception, so we shouldn't see this - echo 'EXCEPTION: ', $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } catch (Throwable $e) { // This is the message that we should see for a caught error - echo 'ERROR: ', $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ERROR: Instantiation of class Closure is not allowed +Error: Instantiation of class Closure is not allowed diff --git a/Zend/tests/closures/closure_write_prop.phpt b/Zend/tests/closures/closure_write_prop.phpt index 8dbf18e67041..909202fd7268 100644 --- a/Zend/tests/closures/closure_write_prop.phpt +++ b/Zend/tests/closures/closure_write_prop.phpt @@ -14,9 +14,9 @@ $a = new A; try { $c = $a->getFn()->b = new stdClass; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property Closure::$b +Error: Cannot create dynamic property Closure::$b diff --git a/Zend/tests/coalesce/assign_coalesce_002.phpt b/Zend/tests/coalesce/assign_coalesce_002.phpt index 0b2c5374bc7a..e26337a7b9d1 100644 --- a/Zend/tests/coalesce/assign_coalesce_002.phpt +++ b/Zend/tests/coalesce/assign_coalesce_002.phpt @@ -21,7 +21,7 @@ $ary = []; try { $ary[id($foo)] ??= do_throw("ex1"); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ary); @@ -47,7 +47,7 @@ $ary = new AA; try { $ary[new Dtor][id($foo)] ??= $bar; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); @@ -66,19 +66,19 @@ $ary = ["foo" => new AA2]; try { $ary[id($foo)][new Dtor] ??= $bar; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); ?> --EXPECT-- id(foo) -ex1 +Exception: ex1 array(0) { } id(foo) -dtor +Exception: dtor string(3) "foo" id(foo) -dtor +Exception: dtor string(3) "foo" diff --git a/Zend/tests/compound_assign_with_numeric_strings.phpt b/Zend/tests/compound_assign_with_numeric_strings.phpt index c6cee53d95c9..6102a1bffe70 100644 --- a/Zend/tests/compound_assign_with_numeric_strings.phpt +++ b/Zend/tests/compound_assign_with_numeric_strings.phpt @@ -12,7 +12,7 @@ try { $n <<= $n; var_dump($n); } catch (ArithmeticError $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $n = "65"; @@ -24,7 +24,7 @@ try { $n >>= $n; var_dump($n); } catch (ArithmeticError $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $n = "0"; @@ -32,7 +32,7 @@ try{ $n %= $n; var_dump($n); } catch (DivisionByZeroError $e) { - echo "\nException: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $n = "-1"; @@ -41,11 +41,8 @@ var_dump($n); ?> --EXPECT-- int(0) - -Exception: Bit shift by negative number +ArithmeticError: Bit shift by negative number int(0) - -Exception: Bit shift by negative number - -Exception: Modulo by zero +ArithmeticError: Bit shift by negative number +DivisionByZeroError: Modulo by zero int(0) diff --git a/Zend/tests/concat/bug81705.phpt b/Zend/tests/concat/bug81705.phpt index 1c00b1c77d4b..86d897b1db3b 100644 --- a/Zend/tests/concat/bug81705.phpt +++ b/Zend/tests/concat/bug81705.phpt @@ -16,4 +16,4 @@ var_dump($my_var); ?> --EXPECT-- error -string(6) "aArray" \ No newline at end of file +string(6) "aArray" diff --git a/Zend/tests/constant_arrays.phpt b/Zend/tests/constant_arrays.phpt index eecc76847545..0c0db6a55f69 100644 --- a/Zend/tests/constant_arrays.phpt +++ b/Zend/tests/constant_arrays.phpt @@ -34,7 +34,7 @@ $recursive[0] = &$recursive; try { define('RECURSION', $recursive); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- @@ -104,4 +104,4 @@ array(1) { object(stdClass)#1 (0) { } } -define(): Argument #2 ($value) cannot be a recursive array +ValueError: define(): Argument #2 ($value) cannot be a recursive array diff --git a/Zend/tests/constants/008.phpt b/Zend/tests/constants/008.phpt index 14e074e5d30a..c863c26d85c9 100644 --- a/Zend/tests/constants/008.phpt +++ b/Zend/tests/constants/008.phpt @@ -6,7 +6,7 @@ define() tests try { var_dump(define(array(1,2,3,4,5), 1)); } catch (TypeError $e) { - echo "TypeError: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(define("TRUE", 1)); diff --git a/Zend/tests/constants/018.phpt b/Zend/tests/constants/018.phpt index f348c2b556cb..622711452f3f 100644 --- a/Zend/tests/constants/018.phpt +++ b/Zend/tests/constants/018.phpt @@ -6,7 +6,7 @@ constant() tests try { var_dump(constant("")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } define("TEST_CONST", 1); @@ -18,7 +18,7 @@ var_dump(constant("TEST_CONST2")); echo "Done\n"; ?> --EXPECT-- -Undefined constant "" +Error: Undefined constant "" int(1) string(4) "test" Done diff --git a/Zend/tests/constants/bug44827.phpt b/Zend/tests/constants/bug44827.phpt index 8e51087480bd..22ed2821ceb5 100644 --- a/Zend/tests/constants/bug44827.phpt +++ b/Zend/tests/constants/bug44827.phpt @@ -6,16 +6,16 @@ Bug #44827 (define() allows :: in constant names) try { define('foo::bar', 1); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { define('::', 1); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -define(): Argument #1 ($constant_name) cannot be a class constant -define(): Argument #1 ($constant_name) cannot be a class constant +ValueError: define(): Argument #1 ($constant_name) cannot be a class constant +ValueError: define(): Argument #1 ($constant_name) cannot be a class constant diff --git a/Zend/tests/constants/bug51791.phpt b/Zend/tests/constants/bug51791.phpt index 7675cb564d26..7a7cf49ecea0 100644 --- a/Zend/tests/constants/bug51791.phpt +++ b/Zend/tests/constants/bug51791.phpt @@ -9,9 +9,9 @@ class A { try { constant('A::B1'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant A::B1 +Error: Undefined constant A::B1 diff --git a/Zend/tests/constants/dynamic_class_const_fetch.phpt b/Zend/tests/constants/dynamic_class_const_fetch.phpt index 1924536b964e..ae97fdfeaf93 100644 --- a/Zend/tests/constants/dynamic_class_const_fetch.phpt +++ b/Zend/tests/constants/dynamic_class_const_fetch.phpt @@ -11,7 +11,7 @@ function test($code) { try { var_dump(eval($code)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -46,19 +46,19 @@ string(3) "bar" string(3) "bar" Warning: Undefined variable $barr in %s : eval()'d code on line %d -Cannot use value of type null as class constant name +TypeError: Cannot use value of type null as class constant name Warning: Undefined variable $barr in %s : eval()'d code on line %d -Cannot use value of type null as class constant name +TypeError: Cannot use value of type null as class constant name string(3) "bar" string(3) "bar" string(3) "Foo" string(3) "Foo" -Cannot use value of type int as class constant name -Cannot use value of type int as class constant name -Cannot use value of type int as class constant name -Cannot use value of type int as class constant name -Cannot use value of type array as class constant name -Cannot use value of type array as class constant name -Cannot use value of type array as class constant name -Cannot use value of type array as class constant name +TypeError: Cannot use value of type int as class constant name +TypeError: Cannot use value of type int as class constant name +TypeError: Cannot use value of type int as class constant name +TypeError: Cannot use value of type int as class constant name +TypeError: Cannot use value of type array as class constant name +TypeError: Cannot use value of type array as class constant name +TypeError: Cannot use value of type array as class constant name +TypeError: Cannot use value of type array as class constant name diff --git a/Zend/tests/constants/dynamic_class_const_fetch_order.phpt b/Zend/tests/constants/dynamic_class_const_fetch_order.phpt index 4003c7db928c..5f2ce5340390 100644 --- a/Zend/tests/constants/dynamic_class_const_fetch_order.phpt +++ b/Zend/tests/constants/dynamic_class_const_fetch_order.phpt @@ -21,7 +21,7 @@ function test($c) { try { echo $c(), "\n"; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -32,6 +32,6 @@ test(fn() => Foo::{bar()}::{foo()}); --EXPECT-- foo() bar() -Undefined constant Foo::BAR +Error: Undefined constant Foo::BAR bar() -Undefined constant Foo::BAR +Error: Undefined constant Foo::BAR diff --git a/Zend/tests/constants/gh10709.phpt b/Zend/tests/constants/gh10709.phpt index f394e1a7882d..02268032a837 100644 --- a/Zend/tests/constants/gh10709.phpt +++ b/Zend/tests/constants/gh10709.phpt @@ -13,7 +13,7 @@ spl_autoload_register(function ($class) { try { new B(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/constants/gh10709_2.phpt b/Zend/tests/constants/gh10709_2.phpt index 723fa29cc94b..3caa800035ab 100644 --- a/Zend/tests/constants/gh10709_2.phpt +++ b/Zend/tests/constants/gh10709_2.phpt @@ -15,7 +15,7 @@ spl_autoload_register(function ($class) { try { var_dump(new B()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt b/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt index 88c20f10cf62..8aa7ccfad0cd 100644 --- a/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt +++ b/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt @@ -5,10 +5,10 @@ Constant Expressions with unsupported operands 002 try { require("constant_expressions_exceptions.inc"); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), ' on line ', $e->getLine(), "\n"; } ?> DONE --EXPECTF-- -Exception: Unsupported operand types: array - array in %s on line %d +TypeError: Unsupported operand types: array - array in %s on line %d DONE diff --git a/Zend/tests/constexpr/gh7771_3.phpt b/Zend/tests/constexpr/gh7771_3.phpt index e44a01a8aec7..582058310255 100644 --- a/Zend/tests/constexpr/gh7771_3.phpt +++ b/Zend/tests/constexpr/gh7771_3.phpt @@ -13,4 +13,3 @@ var_dump(D::HW); ?> --EXPECTF-- Fatal error: Constant expression contains invalid operations in %sgh7771_3.php(7) : eval()'d code on line 1 - diff --git a/Zend/tests/constexpr/new.phpt b/Zend/tests/constexpr/new.phpt index 79bbc41f69b5..468d762c8d97 100644 --- a/Zend/tests/constexpr/new.phpt +++ b/Zend/tests/constexpr/new.phpt @@ -6,7 +6,7 @@ new in constant expressions try { eval('static $a = new DoesNotExist;'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } static $b = new stdClass; @@ -15,7 +15,7 @@ var_dump($b); try { eval('static $c = new stdClass([] + 0);'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test { @@ -25,7 +25,7 @@ class Test { try { eval('static $d = new Test(new stdClass, [] + 0);'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } static $e = new Test(new stdClass, 42); @@ -41,16 +41,16 @@ class Test2 { try { eval('static $f = new Test2();'); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Class "DoesNotExist" not found +Error: Class "DoesNotExist" not found object(stdClass)#2 (0) { } -Unsupported operand types: array + int -Unsupported operand types: array + int +TypeError: Unsupported operand types: array + int +TypeError: Unsupported operand types: array + int object(Test)#4 (2) { ["a"]=> object(stdClass)#1 (0) { @@ -59,4 +59,4 @@ object(Test)#4 (2) { int(42) } Side-effect -Failed to construct +Exception: Failed to construct diff --git a/Zend/tests/constexpr/new_named_params.phpt b/Zend/tests/constexpr/new_named_params.phpt index 6b57088f60fe..79ee83983c6b 100644 --- a/Zend/tests/constexpr/new_named_params.phpt +++ b/Zend/tests/constexpr/new_named_params.phpt @@ -19,7 +19,7 @@ var_dump($c); try { eval('static $d = new Vec(x: 0.0, x: 1.0);'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -48,4 +48,4 @@ object(Vec)#3 (3) { ["z"]=> float(1) } -Named parameter $x overwrites previous argument +Error: Named parameter $x overwrites previous argument diff --git a/Zend/tests/constexpr/new_self_parent.phpt b/Zend/tests/constexpr/new_self_parent.phpt index b134f77a498e..65eb1a5c1bbb 100644 --- a/Zend/tests/constexpr/new_self_parent.phpt +++ b/Zend/tests/constexpr/new_self_parent.phpt @@ -20,13 +20,13 @@ B::method(); try { invalid(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { B::invalid(); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -35,5 +35,5 @@ object(B)#1 (0) { } object(A)#2 (0) { } -Cannot access "self" when no class scope is active -Cannot access "parent" when current class scope has no parent +Error: Cannot access "self" when no class scope is active +Error: Cannot access "parent" when current class scope has no parent diff --git a/Zend/tests/ctor_promotion/ctor_promotion_basic.phpt b/Zend/tests/ctor_promotion/ctor_promotion_basic.phpt index 206f99fd4094..890dd38632c1 100644 --- a/Zend/tests/ctor_promotion/ctor_promotion_basic.phpt +++ b/Zend/tests/ctor_promotion/ctor_promotion_basic.phpt @@ -13,9 +13,9 @@ $point = new Point(1, 2, 3); try { $point->x = "foo"; } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to property Point::$x of type int +TypeError: Cannot assign string to property Point::$x of type int diff --git a/Zend/tests/div_002.phpt b/Zend/tests/div_002.phpt index 22ed3f139338..3dcfda24301b 100644 --- a/Zend/tests/div_002.phpt +++ b/Zend/tests/div_002.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/div_by_zero_compound_refcounted.phpt b/Zend/tests/div_by_zero_compound_refcounted.phpt index 7f0f59622b44..bdac57623ef3 100644 --- a/Zend/tests/div_by_zero_compound_refcounted.phpt +++ b/Zend/tests/div_by_zero_compound_refcounted.phpt @@ -7,10 +7,10 @@ $h .= "2"; try { $h /= 0; } catch (DivisionByZeroError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($h); ?> --EXPECT-- -Division by zero +DivisionByZeroError: Division by zero string(2) "12" diff --git a/Zend/tests/div_by_zero_compound_with_conversion.phpt b/Zend/tests/div_by_zero_compound_with_conversion.phpt index ba391328169f..bbb6b15c18c8 100644 --- a/Zend/tests/div_by_zero_compound_with_conversion.phpt +++ b/Zend/tests/div_by_zero_compound_with_conversion.phpt @@ -6,9 +6,9 @@ $x = 42; try { $$x /= 0; } catch (DivisionByZeroError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $42 in %s on line %d -Division by zero +DivisionByZeroError: Division by zero diff --git a/Zend/tests/dynamic_call/bug48770_2.phpt b/Zend/tests/dynamic_call/bug48770_2.phpt index 14fe28cca23e..3e0a6adb6e54 100644 --- a/Zend/tests/dynamic_call/bug48770_2.phpt +++ b/Zend/tests/dynamic_call/bug48770_2.phpt @@ -26,13 +26,13 @@ class B extends A { try { call_user_func_array(array($this, 'parent::func22'), array($str)); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func_array(array($this, 'parent::inexistent'), array($str)); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } private function func2($str) { @@ -61,7 +61,7 @@ Deprecated: Callables of the form ["C", "parent::func3"] are deprecated in %s on string(27) "B::func3: This should work!" Deprecated: Callables of the form ["C", "parent::func22"] are deprecated in %s on line %d -call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method B::func22() +TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method B::func22() Deprecated: Callables of the form ["C", "parent::inexistent"] are deprecated in %s on line %d -call_user_func_array(): Argument #1 ($callback) must be a valid callback, class B does not have a method "inexistent" +TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class B does not have a method "inexistent" diff --git a/Zend/tests/dynamic_call/bug48770_3.phpt b/Zend/tests/dynamic_call/bug48770_3.phpt index 98311eb8ece6..630acb513d5a 100644 --- a/Zend/tests/dynamic_call/bug48770_3.phpt +++ b/Zend/tests/dynamic_call/bug48770_3.phpt @@ -23,7 +23,7 @@ class B extends A { try { call_user_func_array(array($this, 'self::inexistent'), array($str)); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } private function func2($str) { @@ -52,4 +52,4 @@ Deprecated: Callables of the form ["C", "self::func3"] are deprecated in %s on l string(27) "B::func3: This should work!" Deprecated: Callables of the form ["C", "self::inexistent"] are deprecated in %s on line %d -call_user_func_array(): Argument #1 ($callback) must be a valid callback, class C does not have a method "inexistent" +TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class C does not have a method "inexistent" diff --git a/Zend/tests/dynamic_call/bug68475.phpt b/Zend/tests/dynamic_call/bug68475.phpt index fef8173fc643..42e194e6ef55 100644 --- a/Zend/tests/dynamic_call/bug68475.phpt +++ b/Zend/tests/dynamic_call/bug68475.phpt @@ -37,7 +37,7 @@ $callback = 'TestClass::undefinedMethod'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Reference undefined class. @@ -45,7 +45,7 @@ $callback = 'UndefinedClass::testMethod'; try { $callback(); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -53,5 +53,5 @@ Static method called! Static method called! Static method called with args: arg1, arg2, arg3 Static method called with args: arg1, arg2, arg3 -Call to undefined method TestClass::undefinedMethod() -Class "UndefinedClass" not found +Error: Call to undefined method TestClass::undefinedMethod() +Error: Class "UndefinedClass" not found