diff --git a/Zend/tests/bug47836.phpt b/Zend/tests/bug47836.phpt index 15afc68c48de..41657a79d59b 100644 --- a/Zend/tests/bug47836.phpt +++ b/Zend/tests/bug47836.phpt @@ -6,14 +6,14 @@ Bug #47836 (array operator [] inconsistency when the array has PHP_INT_MAX index $arr[PHP_INT_MAX] = 1; try { $arr[] = 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..db53f2f78d89 100644 --- a/Zend/tests/bug49893.phpt +++ b/Zend/tests/bug49893.phpt @@ -6,8 +6,8 @@ class A { function __destruct() { try { throw new Exception("2"); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -20,10 +20,10 @@ class B { } try { $b = new B(); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + 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..76ba011e743c 100644 --- a/Zend/tests/bug52041.phpt +++ b/Zend/tests/bug52041.phpt @@ -8,33 +8,33 @@ function foo() { try { foo()->a = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a->b = 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a->b++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a += 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foo()->a->b += 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..959f637e956c 100644 --- a/Zend/tests/bug52355.phpt +++ b/Zend/tests/bug52355.phpt @@ -12,8 +12,8 @@ var_dump($foo); try { var_dump(1.0 / -0.0); -} catch (\DivisionByZeroError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + 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..c5cb4375dfd3 100644 --- a/Zend/tests/bug52614.phpt +++ b/Zend/tests/bug52614.phpt @@ -54,8 +54,8 @@ var_dump($foo->a3); try { $foo->f4()->a = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..f7573c0ba041 100644 --- a/Zend/tests/bug53432.phpt +++ b/Zend/tests/bug53432.phpt @@ -18,32 +18,32 @@ var_dump($str); $str = ''; try { var_dump($str['foo'] = 'a'); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); $str = ''; try { var_dump($str[] = 'a'); -} catch (Error $e) { - echo "Error: {$e->getMessage()}\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); $str = ''; try { var_dump($str[0] += 1); -} catch (Error $e) { - echo "Error: {$e->getMessage()}\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); $str = ''; try { var_dump($str[0][0] = 'a'); -} catch (Error $e) { - echo "Error: {$e->getMessage()}\n"; +} catch (Throwable $e) { + 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..7e723e06de10 100644 --- a/Zend/tests/bug63882.phpt +++ b/Zend/tests/bug63882.phpt @@ -11,10 +11,10 @@ $testobj2->x = $testobj2; try { var_dump($testobj1 == $testobj2); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..a6a54fd4aa39 100644 --- a/Zend/tests/bug65784.phpt +++ b/Zend/tests/bug65784.phpt @@ -16,9 +16,9 @@ function foo1() { try { $foo = foo1(); var_dump($foo); -} catch (Exception $e) { +} catch (Throwable $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..c106fbe470b9 100644 --- a/Zend/tests/bug69017.phpt +++ b/Zend/tests/bug69017.phpt @@ -18,8 +18,8 @@ c1::$a1[] = 1; c1::$a2[] = 1; try { c1::$a3[] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..f20d0d1c0357 100644 --- a/Zend/tests/bug69315.phpt +++ b/Zend/tests/bug69315.phpt @@ -9,42 +9,42 @@ var_dump(function_exists("strlen")); var_dump(is_callable("strlen")); try { var_dump(strlen("xxx")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(defined("PHP_VERSION")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(constant("PHP_VERSION")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(call_user_func("strlen")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(is_string("xxx")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(is_string()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..288f2f1eec82 100644 --- a/Zend/tests/bug70083.phpt +++ b/Zend/tests/bug70083.phpt @@ -15,14 +15,14 @@ function &noref() { $foo = 1; return $foo; } $foo = new foo; try { $foo->i = &noref(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..94a660d4a4a2 100644 --- a/Zend/tests/bug70089.phpt +++ b/Zend/tests/bug70089.phpt @@ -7,29 +7,29 @@ function dummy($a) { try { chr(0)[0][] = 1; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset(chr(0)[0][0]); -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } eval("function runtimetest(&\$a) {} "); try { runtimetest(chr(0)[0]); -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ++chr(0)[0]; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + 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/bug70895.phpt b/Zend/tests/bug70895.phpt index afbea1c91d76..c3b2edf957e4 100644 --- a/Zend/tests/bug70895.phpt +++ b/Zend/tests/bug70895.phpt @@ -5,21 +5,21 @@ Bug #70895 null ptr deref and segfault with crafted callable try { array_map("%n", 0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_map("%n %i", 0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_map("%n %i aoeu %f aoeu %p", 0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3a41f4d767e5 100644 --- a/Zend/tests/bug70898.phpt +++ b/Zend/tests/bug70898.phpt @@ -8,9 +8,9 @@ function m($f,$a){ try { echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",(""))))))); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..323428ac5d99 100644 --- a/Zend/tests/bug70914.phpt +++ b/Zend/tests/bug70914.phpt @@ -9,9 +9,9 @@ $db = new PDO('sqlite::memory:'); $st = $db->query('SELECT 1'); try { $re = $st->fetchObject('%Z'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..cb11c3e89532 100644 --- a/Zend/tests/bug70918.phpt +++ b/Zend/tests/bug70918.phpt @@ -4,44 +4,44 @@ Bug #70918 (Segfault using static outside of class scope) getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { parent::x; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { self::x; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new static; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { static::x(); -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { static::$i; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + 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..cef48b222127 100644 --- a/Zend/tests/bug71196.phpt +++ b/Zend/tests/bug71196.phpt @@ -5,9 +5,9 @@ Bug #71196 (Memory leak with out-of-order live ranges) try { $a = "1"; [1, (y().$a.$a) . ($a.$a)]; -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + 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..46edce32a29b 100644 --- a/Zend/tests/bug71572.phpt +++ b/Zend/tests/bug71572.phpt @@ -6,29 +6,29 @@ Bug #71572: String offset assignment from an empty string inserts null byte $str = "abc"; try { var_dump($str[0] = ""); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($str[1] = ""); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($str[3] = ""); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($str[10] = ""); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + 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..54d6d6ae88dc 100644 --- a/Zend/tests/bug72038.phpt +++ b/Zend/tests/bug72038.phpt @@ -6,14 +6,14 @@ Bug #72038 (Function calls with values to a by-ref parameter don't always throw try { test($foo = new stdClass); var_dump($foo); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test($bar = 2); var_dump($bar); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..01cf33588248 100644 --- a/Zend/tests/bug72107.phpt +++ b/Zend/tests/bug72107.phpt @@ -8,9 +8,9 @@ function test($a) { } try { test(1); -} catch (\Error $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + 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..91509fb227f1 100644 --- a/Zend/tests/bug74084.phpt +++ b/Zend/tests/bug74084.phpt @@ -8,30 +8,30 @@ $$A += $$B['a'] = &$$C; unset($$A); try { $$A -= $$B['a'] = &$$C; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($$A); try { $$A *= $$B['a'] = &$$C; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($$A); try { $$A /= $$B['a'] = &$$C; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($$A); try { $$A **= $$B['a'] = &$$C; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..a0372c4798ab 100644 --- a/Zend/tests/bug75218.phpt +++ b/Zend/tests/bug75218.phpt @@ -6,8 +6,8 @@ Bug #75218: Change remaining uncatchable fatal errors for parsing into ParseErro function try_eval($code) { try { eval($code); - } catch (CompileError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..454257ca44bc 100644 --- a/Zend/tests/bug75252.phpt +++ b/Zend/tests/bug75252.phpt @@ -12,17 +12,17 @@ CODE; try { eval($code); -} catch (ParseError $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { eval($code); -} catch (ParseError $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + 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..56db3edb2669 100644 --- a/Zend/tests/bug75921.phpt +++ b/Zend/tests/bug75921.phpt @@ -5,63 +5,63 @@ Bug #75921: Inconsistent error when creating stdObject from empty variable try { $null->a = 42; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); try { $null->a['hello'] = 42; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); try { $null->a->b = 42; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); try { $null->a['hello']->b = 42; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($null); unset($null); try { $null->a->b['hello'] = 42; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..37a1e009f51c 100644 --- a/Zend/tests/bug78154.phpt +++ b/Zend/tests/bug78154.phpt @@ -7,8 +7,8 @@ namespace { try { var_dump(similar_text('a', 'a', $c=0x44444444)); var_dump($c); - } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + } catch (\Throwable $e) { + 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..b5aa2d0bb542 100644 --- a/Zend/tests/bug78182.phpt +++ b/Zend/tests/bug78182.phpt @@ -6,11 +6,11 @@ $varName = 'var'; $propName = 'prop'; try { $$varName->$propName =& $$varName; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..4f2d2e9d1b98 100644 --- a/Zend/tests/bug78531.phpt +++ b/Zend/tests/bug78531.phpt @@ -4,34 +4,34 @@ Bug #78531 (Crash when using undefined variable as object) a += 5; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = ++$u2->a; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = $u3->a++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $u4->a->a += 5; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..9ca4c2a14a0c 100644 --- a/Zend/tests/bug78810.phpt +++ b/Zend/tests/bug78810.phpt @@ -10,16 +10,16 @@ class Test { $test = new Test; try { $test->i++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->i += 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..f0a35b66964b 100644 --- a/Zend/tests/bug78926.phpt +++ b/Zend/tests/bug78926.phpt @@ -11,12 +11,12 @@ spl_autoload_register(function($class) { try { class B extends A {} -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..5de37578fa79 100644 --- a/Zend/tests/bug79599.phpt +++ b/Zend/tests/bug79599.phpt @@ -13,15 +13,15 @@ function test2(){ } try{ test1(); -}catch(\Exception $e){ - var_dump($e->getMessage()); +}catch(\Throwable $e){ + echo $e::class, ': ', $e->getMessage(), "\n"; } try{ test2(); -}catch(\Exception $e){ - var_dump($e->getMessage()); +}catch(\Throwable $e){ + 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..4e74631855ed 100644 --- a/Zend/tests/bug79947.phpt +++ b/Zend/tests/bug79947.phpt @@ -6,12 +6,12 @@ $array = []; $key = []; try { $array[$key] += [$key]; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..6ca8623f8328 100644 --- a/Zend/tests/bug80972.phpt +++ b/Zend/tests/bug80972.phpt @@ -19,8 +19,8 @@ try { echo 'Float casted to string compile', \PHP_EOL; $string[(string) 10e120] = 'E'; var_dump($string); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + 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..12771d287170 100644 --- a/Zend/tests/call_to_abstract_method_args.phpt +++ b/Zend/tests/call_to_abstract_method_args.phpt @@ -9,18 +9,18 @@ abstract class Test { try { Test::method(new stdClass); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = new stdClass; try { $ret = Test::method(new stdClass); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..99da008a90c1 100644 --- a/Zend/tests/call_to_deprecated_function_args.phpt +++ b/Zend/tests/call_to_deprecated_function_args.phpt @@ -11,35 +11,35 @@ set_error_handler(function($code, $msg) { try { zend_test_deprecated(new stdClass); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = new stdClass; try { $ret = zend_test_deprecated(new stdClass()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $fn = 'zend_test_deprecated'; $fn(new stdClass); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = new stdClass; try { $fn = 'zend_test_deprecated'; $ret = $fn(new stdClass); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..e52301a70d1d 100644 --- a/Zend/tests/call_user_functions/call_user_func_001.phpt +++ b/Zend/tests/call_user_functions/call_user_func_001.phpt @@ -24,18 +24,18 @@ namespace testing { $class = __NAMESPACE__ .'\foo'; try { call_user_func(array(new $class, 'priv'), 'foobar'); - } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array(new $class, 'prot'), 'foobar'); - } catch (\TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + 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..9d8f5ffaf344 100644 --- a/Zend/tests/call_user_functions/call_user_func_002.phpt +++ b/Zend/tests/call_user_functions/call_user_func_002.phpt @@ -9,33 +9,33 @@ spl_autoload_register(function ($class) { try { call_user_func(array('foo', 'bar')); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array('', 'bar')); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array($foo, 'bar')); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array($foo, '')); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0f1d34d21a6f 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 @@ -8,8 +8,8 @@ $array = [1, 2, 3]; try { $len = []; call_user_func_array('var_dump', array_slice($array, 0, $len)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..6df84210c5ce 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 @@ -9,15 +9,15 @@ $array = [1, 2, 3]; try { $len = []; call_user_func_array('var_dump', array_slice($array, 0, $len)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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..dee17a371a46 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 @@ -10,9 +10,9 @@ class drv { $drv = new drv; try { call_user_func_array(array($drv, 'func'), null); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b8370fcafbd5 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 @@ -7,11 +7,11 @@ function test(Type &$ref) { } try { call_user_func('test', 0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..8322c433d67e 100644 --- a/Zend/tests/callable_param_exception_leak.phpt +++ b/Zend/tests/callable_param_exception_leak.phpt @@ -7,9 +7,9 @@ spl_autoload_register(function ($class) { }); try { array_map('A::b', []); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3d51aa382b9d 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 @@ -5,16 +5,16 @@ Cannot access self::class when no class scope is active try { var_dump(self::class); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump([self::class]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..8d6627aed210 100644 --- a/Zend/tests/class_name/class_on_object.phpt +++ b/Zend/tests/class_name/class_on_object.phpt @@ -16,8 +16,8 @@ function test() { } try { test(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..f7ff1aaf5820 100644 --- a/Zend/tests/clone/ast.phpt +++ b/Zend/tests/clone/ast.phpt @@ -8,87 +8,87 @@ $x = new stdClass(); try { assert(false && $y = clone $x); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x)); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, )); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, [ "foo" => $foo, "bar" => $bar ])); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, $array)); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone($x, $array, $extraParameter, $trailingComma, )); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + 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; +} catch (Throwable $e) { + 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; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(object: $x)); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + 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; +} catch (Throwable $e) { + 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; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && $y = clone(...)); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + 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..4da0bd4ad0d8 100644 --- a/Zend/tests/closures/bug79778.phpt +++ b/Zend/tests/closures/bug79778.phpt @@ -11,8 +11,8 @@ print_r($closure1); try { $closure1(); -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + 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..073c72836de2 100644 --- a/Zend/tests/closures/closure_015.phpt +++ b/Zend/tests/closures/closure_015.phpt @@ -6,16 +6,16 @@ Closure 015: converting to string/unicode $x = function() { return 1; }; try { print (string) $x; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { print $x; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..63b836a35cfc 100644 --- a/Zend/tests/closures/closure_021.phpt +++ b/Zend/tests/closures/closure_021.phpt @@ -13,10 +13,10 @@ $foo = function() { try { $foo(); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + 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..e6ae5063a84c 100644 --- a/Zend/tests/closures/closure_031.phpt +++ b/Zend/tests/closures/closure_031.phpt @@ -10,8 +10,8 @@ $foo = function() { }; try { var_dump($foo->a); -} catch (Error $ex) { - echo "Error: {$ex->getMessage()}\n"; +} catch (Throwable $ex) { + 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..82d4aa245c77 100644 --- a/Zend/tests/closures/closure_040.phpt +++ b/Zend/tests/closures/closure_040.phpt @@ -26,14 +26,14 @@ $cas = $a->getStaticIncrementor(); try { $ca->bindTo($a, array()); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..4b4620c4aa54 100644 --- a/Zend/tests/closures/closure_059.phpt +++ b/Zend/tests/closures/closure_059.phpt @@ -19,21 +19,21 @@ call_user_func(array($f,"__invoke"), $a); try { $f($b); -} catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f->__invoke($b); -} catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func(array($f,"__invoke"), $b); -} catch (Error $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..12a94ac19269 100644 --- a/Zend/tests/closures/closure_array_key_error.phpt +++ b/Zend/tests/closures/closure_array_key_error.phpt @@ -5,10 +5,10 @@ Trying to use lambda as array key try { var_dump(array(function() { } => 1)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..4ad86277061b 100644 --- a/Zend/tests/closures/closure_array_offset_error.phpt +++ b/Zend/tests/closures/closure_array_offset_error.phpt @@ -5,10 +5,10 @@ Trying to use lambda in array offset try { $test[function(){}] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..046a1e371fa6 100644 --- a/Zend/tests/closures/closure_const_expr/attributes_ast_printing.phpt +++ b/Zend/tests/closures/closure_const_expr/attributes_ast_printing.phpt @@ -13,8 +13,8 @@ try { })] function () { } ); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -25,17 +25,17 @@ try { })] class {} ); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..ae54c6182c69 100644 --- a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt +++ b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt @@ -11,10 +11,10 @@ class A { try { $fn = Closure::fromCallable(['A', 'method']); $fn(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..e5af665e129f 100644 --- a/Zend/tests/closures/closure_get_current.phpt +++ b/Zend/tests/closures/closure_get_current.phpt @@ -23,8 +23,8 @@ function fail() { try { fail(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function foo() { @@ -33,8 +33,8 @@ function foo() { try { foo(...)(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..55918966fcc3 100644 --- a/Zend/tests/closures/closure_instantiate.phpt +++ b/Zend/tests/closures/closure_instantiate.phpt @@ -8,14 +8,14 @@ Mark Baker mark@lange.demon.co.uk at the PHPNW2017 Conference for PHP Testfest 2 try { // Closures should be instantiatable using new $x = new Closure(); -} catch (Exception $e) { +} catch (Throwable $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..2c0d469d88ab 100644 --- a/Zend/tests/closures/closure_write_prop.phpt +++ b/Zend/tests/closures/closure_write_prop.phpt @@ -13,10 +13,10 @@ class A { $a = new A; try { $c = $a->getFn()->b = new stdClass; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..ef466865ac12 100644 --- a/Zend/tests/coalesce/assign_coalesce_002.phpt +++ b/Zend/tests/coalesce/assign_coalesce_002.phpt @@ -20,8 +20,8 @@ function do_throw($msg) { $ary = []; try { $ary[id($foo)] ??= do_throw("ex1"); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ary); @@ -46,8 +46,8 @@ class Dtor { $ary = new AA; try { $ary[new Dtor][id($foo)] ??= $bar; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); @@ -65,20 +65,20 @@ class AA2 implements ArrayAccess { $ary = ["foo" => new AA2]; try { $ary[id($foo)][new Dtor] ??= $bar; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..056394e8ef84 100644 --- a/Zend/tests/compound_assign_with_numeric_strings.phpt +++ b/Zend/tests/compound_assign_with_numeric_strings.phpt @@ -11,8 +11,8 @@ $n = "-1"; try { $n <<= $n; var_dump($n); -} catch (ArithmeticError $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $n = "65"; @@ -23,16 +23,16 @@ $n = "-1"; try { $n >>= $n; var_dump($n); -} catch (ArithmeticError $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $n = "0"; try{ $n %= $n; var_dump($n); -} catch (DivisionByZeroError $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..5a8ecaa908ed 100644 --- a/Zend/tests/constant_arrays.phpt +++ b/Zend/tests/constant_arrays.phpt @@ -33,8 +33,8 @@ $recursive[0] = &$recursive; try { define('RECURSION', $recursive); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + 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..e569cfc5a92b 100644 --- a/Zend/tests/constants/008.phpt +++ b/Zend/tests/constants/008.phpt @@ -5,8 +5,8 @@ define() tests try { var_dump(define(array(1,2,3,4,5), 1)); -} catch (TypeError $e) { - echo "TypeError: ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..569144e05263 100644 --- a/Zend/tests/constants/018.phpt +++ b/Zend/tests/constants/018.phpt @@ -5,8 +5,8 @@ constant() tests try { var_dump(constant("")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b8f39508a86a 100644 --- a/Zend/tests/constants/bug44827.phpt +++ b/Zend/tests/constants/bug44827.phpt @@ -5,17 +5,17 @@ Bug #44827 (define() allows :: in constant names) try { define('foo::bar', 1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { define('::', 1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + 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..ff104ece7a6b 100644 --- a/Zend/tests/constants/bug51791.phpt +++ b/Zend/tests/constants/bug51791.phpt @@ -8,10 +8,10 @@ class A { } try { constant('A::B1'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..c5ed2395a393 100644 --- a/Zend/tests/constants/gh10709.phpt +++ b/Zend/tests/constants/gh10709.phpt @@ -12,8 +12,8 @@ spl_autoload_register(function ($class) { try { new B(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/constants/gh10709_2.phpt b/Zend/tests/constants/gh10709_2.phpt index 723fa29cc94b..a5a36bce6944 100644 --- a/Zend/tests/constants/gh10709_2.phpt +++ b/Zend/tests/constants/gh10709_2.phpt @@ -14,8 +14,8 @@ spl_autoload_register(function ($class) { try { var_dump(new B()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..6823d38137bb 100644 --- a/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt +++ b/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt @@ -4,11 +4,11 @@ Constant Expressions with unsupported operands 002 getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; +} catch (Throwable $e) { + 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..7cd5611d2235 100644 --- a/Zend/tests/constexpr/new.phpt +++ b/Zend/tests/constexpr/new.phpt @@ -5,8 +5,8 @@ new in constant expressions try { eval('static $a = new DoesNotExist;'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } static $b = new stdClass; @@ -14,8 +14,8 @@ var_dump($b); try { eval('static $c = new stdClass([] + 0);'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test { @@ -24,8 +24,8 @@ class Test { try { eval('static $d = new Test(new stdClass, [] + 0);'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } static $e = new Test(new stdClass, 42); @@ -40,17 +40,17 @@ class Test2 { try { eval('static $f = new Test2();'); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3ff3ab6679f0 100644 --- a/Zend/tests/constexpr/new_named_params.phpt +++ b/Zend/tests/constexpr/new_named_params.phpt @@ -18,8 +18,8 @@ var_dump($c); try { eval('static $d = new Vec(x: 0.0, x: 1.0);'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..80aa36b5b0d7 100644 --- a/Zend/tests/constexpr/new_self_parent.phpt +++ b/Zend/tests/constexpr/new_self_parent.phpt @@ -19,14 +19,14 @@ B::method(); try { invalid(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { B::invalid(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..747c42167c10 100644 --- a/Zend/tests/ctor_promotion/ctor_promotion_basic.phpt +++ b/Zend/tests/ctor_promotion/ctor_promotion_basic.phpt @@ -12,10 +12,10 @@ $point = new Point(1, 2, 3); // Check that properties really are typed. try { $point->x = "foo"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0de52bc2ecb2 100644 --- a/Zend/tests/div_002.phpt +++ b/Zend/tests/div_002.phpt @@ -8,8 +8,8 @@ $b = array(1); try { var_dump($a / $b); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..519a8bff42e2 100644 --- a/Zend/tests/div_by_zero_compound_refcounted.phpt +++ b/Zend/tests/div_by_zero_compound_refcounted.phpt @@ -6,11 +6,11 @@ $h = "1"; $h .= "2"; try { $h /= 0; -} catch (DivisionByZeroError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1c3bcf0a2bf0 100644 --- a/Zend/tests/div_by_zero_compound_with_conversion.phpt +++ b/Zend/tests/div_by_zero_compound_with_conversion.phpt @@ -5,10 +5,10 @@ Division by zero in compound operator with type coercion $x = 42; try { $$x /= 0; -} catch (DivisionByZeroError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..46f57d0d7a95 100644 --- a/Zend/tests/dynamic_call/bug48770_2.phpt +++ b/Zend/tests/dynamic_call/bug48770_2.phpt @@ -25,14 +25,14 @@ class B extends A { try { call_user_func_array(array($this, 'parent::func22'), array($str)); - } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + 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; + } catch (\Throwable $e) { + 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..6f95117d072e 100644 --- a/Zend/tests/dynamic_call/bug48770_3.phpt +++ b/Zend/tests/dynamic_call/bug48770_3.phpt @@ -22,8 +22,8 @@ class B extends A { try { call_user_func_array(array($this, 'self::inexistent'), array($str)); - } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + 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..e3d717b62877 100644 --- a/Zend/tests/dynamic_call/bug68475.phpt +++ b/Zend/tests/dynamic_call/bug68475.phpt @@ -36,16 +36,16 @@ $callback(...$args); $callback = 'TestClass::undefinedMethod'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Reference undefined class. $callback = 'UndefinedClass::testMethod'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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