From ae77efb8cc1f7a59e1078bb3d416381a18f16b85 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Wed, 19 Aug 2026 21:07:10 +0700 Subject: [PATCH 1/2] Zend: applied fixers to improve test robustness (part 3/8) --- Zend/tests/dynamic_call/bug77877.phpt | 8 +- Zend/tests/dynamic_call/dynamic_call_005.phpt | 18 ++-- Zend/tests/dynamic_call/dynamic_call_006.phpt | 36 +++---- Zend/tests/dynamic_call/dynamic_call_007.phpt | 6 +- Zend/tests/dynamic_call/dynamic_call_008.phpt | 6 +- .../dynamic_call/dynamic_call_freeing.phpt | 18 ++-- .../dynamic_call/dynamic_call_non_static.phpt | 12 +-- .../dynamic_fully_qualified_call.phpt | 6 +- Zend/tests/dynamic_prop_deprecation_002.phpt | 4 +- Zend/tests/enum/ast-dumper.phpt | 6 +- Zend/tests/enum/backed-duplicate-int.phpt | 24 ++--- Zend/tests/enum/backed-duplicate-string.phpt | 24 ++--- Zend/tests/enum/backed-from-invalid-int.phpt | 6 +- .../enum/backed-from-invalid-string.phpt | 6 +- Zend/tests/enum/backed-from-invalid-type.phpt | 12 +-- Zend/tests/enum/backed-mismatch.phpt | 16 +-- Zend/tests/enum/enum-as-params.phpt | 12 +-- Zend/tests/enum/internal_enums.phpt | 4 +- .../enum/internal_enums_strict_types.phpt | 12 +-- Zend/tests/enum/json_encode.phpt | 4 +- Zend/tests/enum/no-clone-internal.phpt | 6 +- Zend/tests/enum/no-clone.phpt | 6 +- .../enum/no-dynamic-properties-internal.phpt | 6 +- Zend/tests/enum/no-dynamic-properties.phpt | 6 +- .../tests/enum/no-new-through-reflection.phpt | 6 +- Zend/tests/enum/no-new.phpt | 6 +- .../tests/enum/no-pass-properties-by-ref.phpt | 6 +- .../enum/no-return-properties-by-ref.phpt | 6 +- Zend/tests/enum/no-unset-propertes.phpt | 18 ++-- .../enum/no-write-properties-cache-slot.phpt | 6 +- ...-properties-through-foreach-reference.phpt | 6 +- ...o-write-properties-through-references.phpt | 6 +- Zend/tests/enum/no-write-properties.phpt | 30 +++--- Zend/tests/errmsg/bug43344_1.phpt | 24 ++--- Zend/tests/errmsg/errmsg_020.phpt | 6 +- Zend/tests/error_reporting/bug72162.phpt | 6 +- Zend/tests/eval_constant_resolution.phpt | 2 +- Zend/tests/exception_set_previous_leak.phpt | 6 +- Zend/tests/exception_stream_wrapper.phpt | 6 +- Zend/tests/exceptions/bug26698.phpt | 18 ++-- Zend/tests/exceptions/bug47771.phpt | 4 +- Zend/tests/exceptions/bug48428.phpt | 6 +- Zend/tests/exceptions/bug50383.phpt | 12 +-- Zend/tests/exceptions/bug53511.phpt | 4 +- Zend/tests/exceptions/bug54043.phpt | 6 +- Zend/tests/exceptions/bug60569.phpt | 7 +- Zend/tests/exceptions/exception_001.phpt | 24 ++--- Zend/tests/exceptions/exception_013.phpt | 20 ++-- Zend/tests/exceptions/exception_014.phpt | 6 +- Zend/tests/exceptions/exception_015.phpt | 6 +- Zend/tests/exceptions/exception_016.phpt | 6 +- .../exceptions/exception_before_fatal.phpt | 28 ++--- ...ception_during_by_reference_magic_get.phpt | 6 +- .../exception_during_include_stat.phpt | 24 ++--- .../exceptions/exception_from_toString.phpt | 100 +++++++++--------- .../exception_handler_004.phpt | 12 +-- .../tests/exit/die_string_cast_exception.phpt | 6 +- Zend/tests/exit_finally_2.phpt | 4 +- Zend/tests/fe_fetch_dtor_exception.phpt | 6 +- Zend/tests/fe_fetch_op2_live_range.phpt | 6 +- Zend/tests/fibers/catch.phpt | 6 +- Zend/tests/fibers/fiber-error-construct.phpt | 6 +- .../fibers/get-return-after-throwing.phpt | 6 +- Zend/tests/fibers/gh10249.phpt | 6 +- Zend/tests/fibers/gh20483.phpt | 6 +- Zend/tests/fibers/negative_stack_size.phpt | 2 +- ...-force-close-fiber-catching-exception.phpt | 6 +- ...nfinished-fiber-with-throw-in-finally.phpt | 12 +-- .../constexpr/attributes_ast_printing.phpt | 12 +-- .../error_static_call_trait_method_002.phpt | 6 +- .../first_class_callable_015.phpt | 6 +- .../first_class_callable_assert.phpt | 12 +-- .../first_class_callable_errors.phpt | 42 ++++---- Zend/tests/foreach/foreach_003.phpt | 42 ++++---- Zend/tests/frameless_undefined_var.phpt | 6 +- Zend/tests/func_arg_fetch_optimization.phpt | 6 +- Zend/tests/func_get_arg_basic.phpt | 78 +++++++------- Zend/tests/func_get_arg_invalid.phpt | 12 +-- Zend/tests/func_get_args.phpt | 6 +- Zend/tests/func_get_args_basic.phpt | 14 +-- Zend/tests/func_num_args_basic.phpt | 14 +-- .../argument_count_incorrect_internal.phpt | 6 +- ...ument_count_incorrect_internal_strict.phpt | 16 ++- .../argument_count_incorrect_userland.phpt | 32 +++--- ...ument_count_incorrect_userland_strict.phpt | 40 +++---- ...parameter_correctly_captures_original.phpt | 12 +-- 86 files changed, 552 insertions(+), 575 deletions(-) diff --git a/Zend/tests/dynamic_call/bug77877.phpt b/Zend/tests/dynamic_call/bug77877.phpt index 6ed35213efb2..9c32424de1c2 100644 --- a/Zend/tests/dynamic_call/bug77877.phpt +++ b/Zend/tests/dynamic_call/bug77877.phpt @@ -10,14 +10,14 @@ class Foo { try { array_map([new Foo, 'bar'],[1]); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func([new Foo, 'bar']); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Using $this when not in object context -Using $this when not in object context +Error: Using $this when not in object context +Error: Using $this when not in object context diff --git a/Zend/tests/dynamic_call/dynamic_call_005.phpt b/Zend/tests/dynamic_call/dynamic_call_005.phpt index 91d1cb914c12..e651b54a8b72 100644 --- a/Zend/tests/dynamic_call/dynamic_call_005.phpt +++ b/Zend/tests/dynamic_call/dynamic_call_005.phpt @@ -9,28 +9,28 @@ function test_calls($func) { try { array_map($func, [['i' => new stdClass]]); var_dump($i); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $func(['i' => new stdClass]); var_dump($i); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func($func, ['i' => new stdClass]); var_dump($i); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } test_calls('extract'); ?> --EXPECT-- -Cannot call extract() dynamically -Cannot call extract() dynamically -Cannot call extract() dynamically +Error: Cannot call extract() dynamically +Error: Cannot call extract() dynamically +Error: Cannot call extract() dynamically diff --git a/Zend/tests/dynamic_call/dynamic_call_006.phpt b/Zend/tests/dynamic_call/dynamic_call_006.phpt index e6ea71915854..b1948e340add 100644 --- a/Zend/tests/dynamic_call/dynamic_call_006.phpt +++ b/Zend/tests/dynamic_call/dynamic_call_006.phpt @@ -7,52 +7,52 @@ function test() { try { $func = 'extract'; $func(['a' => 'b']); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $func = 'compact'; $func(['a']); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $func = 'get_defined_vars'; $func(); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $func = 'func_get_args'; $func(); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $func = 'func_get_arg'; $func(1); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $func = 'func_num_args'; $func(); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } test(); ?> --EXPECT-- -Cannot call extract() dynamically -Cannot call compact() dynamically -Cannot call get_defined_vars() dynamically -Cannot call func_get_args() dynamically -Cannot call func_get_arg() dynamically -Cannot call func_num_args() dynamically +Error: Cannot call extract() dynamically +Error: Cannot call compact() dynamically +Error: Cannot call get_defined_vars() dynamically +Error: Cannot call func_get_args() dynamically +Error: Cannot call func_get_arg() dynamically +Error: Cannot call func_num_args() dynamically diff --git a/Zend/tests/dynamic_call/dynamic_call_007.phpt b/Zend/tests/dynamic_call/dynamic_call_007.phpt index f1312b95b47a..5d99ba5d5352 100644 --- a/Zend/tests/dynamic_call/dynamic_call_007.phpt +++ b/Zend/tests/dynamic_call/dynamic_call_007.phpt @@ -7,8 +7,8 @@ function test() { $i = 1; try { array_map('extract', [['i' => new stdClass]]); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $i += 1; var_dump($i); @@ -17,5 +17,5 @@ test(); ?> --EXPECT-- -Cannot call extract() dynamically +Error: Cannot call extract() dynamically int(2) diff --git a/Zend/tests/dynamic_call/dynamic_call_008.phpt b/Zend/tests/dynamic_call/dynamic_call_008.phpt index 1916bcf91345..97c21e69a0a2 100644 --- a/Zend/tests/dynamic_call/dynamic_call_008.phpt +++ b/Zend/tests/dynamic_call/dynamic_call_008.phpt @@ -6,12 +6,12 @@ Don't optimize dynamic call to non-dynamic one if it drops the warning function test() { try { ((string) 'extract')(['a' => 42]); - } catch (\Error $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } test(); ?> --EXPECT-- -Cannot call extract() dynamically +Error: Cannot call extract() dynamically diff --git a/Zend/tests/dynamic_call/dynamic_call_freeing.phpt b/Zend/tests/dynamic_call/dynamic_call_freeing.phpt index 1bba3ebf6be1..03851cb77940 100644 --- a/Zend/tests/dynamic_call/dynamic_call_freeing.phpt +++ b/Zend/tests/dynamic_call/dynamic_call_freeing.phpt @@ -6,23 +6,23 @@ Freeing of function "name" when dynamic call fails try { $bar = "bar"; ("foo" . $bar)(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $bar = ["bar"]; (["foo"] + $bar)(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (new stdClass)(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to undefined function foobar() -Array callback must have exactly two elements -Object of type stdClass is not callable +Error: Call to undefined function foobar() +Error: Array callback must have exactly two elements +Error: Object of type stdClass is not callable diff --git a/Zend/tests/dynamic_call/dynamic_call_non_static.phpt b/Zend/tests/dynamic_call/dynamic_call_non_static.phpt index f73d29a131d6..f2ff0faa1dee 100644 --- a/Zend/tests/dynamic_call/dynamic_call_non_static.phpt +++ b/Zend/tests/dynamic_call/dynamic_call_non_static.phpt @@ -16,15 +16,15 @@ class Foo { $x = new Foo; try { $x->test1(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x->test2(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Non-static method Foo::bar() cannot be called statically -Non-static method Foo::bar() cannot be called statically +Error: Non-static method Foo::bar() cannot be called statically +Error: Non-static method Foo::bar() cannot be called statically diff --git a/Zend/tests/dynamic_call/dynamic_fully_qualified_call.phpt b/Zend/tests/dynamic_call/dynamic_fully_qualified_call.phpt index cca6fa38b6c3..ebfc7f4059a4 100644 --- a/Zend/tests/dynamic_call/dynamic_fully_qualified_call.phpt +++ b/Zend/tests/dynamic_call/dynamic_fully_qualified_call.phpt @@ -6,10 +6,10 @@ Crash when using dynamic call syntax with fully qualified name in a namespace namespace Foo; try { ('\bar')(); -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to undefined function bar() +Error: Call to undefined function bar() diff --git a/Zend/tests/dynamic_prop_deprecation_002.phpt b/Zend/tests/dynamic_prop_deprecation_002.phpt index bd0d3aa5a7df..980bbef7d8dd 100644 --- a/Zend/tests/dynamic_prop_deprecation_002.phpt +++ b/Zend/tests/dynamic_prop_deprecation_002.phpt @@ -10,9 +10,9 @@ $a = new class{}; try { [&$a->y]; } catch (Throwable $ex) { - echo "Exception: " .$ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- Err: Creation of dynamic property class@anonymous::$y is deprecated -Exception: Cannot create dynamic property class@anonymous::$y +Error: Cannot create dynamic property class@anonymous::$y diff --git a/Zend/tests/enum/ast-dumper.phpt b/Zend/tests/enum/ast-dumper.phpt index 7972fe64965e..f421f6ffa67c 100644 --- a/Zend/tests/enum/ast-dumper.phpt +++ b/Zend/tests/enum/ast-dumper.phpt @@ -22,13 +22,13 @@ try { return false; })()); -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert((function () { +AssertionError: assert((function () { enum Foo { case Bar; } diff --git a/Zend/tests/enum/backed-duplicate-int.phpt b/Zend/tests/enum/backed-duplicate-int.phpt index fb64ff29322e..11c9f68214b8 100644 --- a/Zend/tests/enum/backed-duplicate-int.phpt +++ b/Zend/tests/enum/backed-duplicate-int.phpt @@ -10,31 +10,31 @@ enum Foo: int { try { var_dump(Foo::Bar); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::Bar); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::from(42)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::tryFrom('bar')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Duplicate value in enum Foo for cases Bar and Baz -Duplicate value in enum Foo for cases Bar and Baz -Duplicate value in enum Foo for cases Bar and Baz -Foo::tryFrom(): Argument #1 ($value) must be of type int, string given +Error: Duplicate value in enum Foo for cases Bar and Baz +Error: Duplicate value in enum Foo for cases Bar and Baz +Error: Duplicate value in enum Foo for cases Bar and Baz +TypeError: Foo::tryFrom(): Argument #1 ($value) must be of type int, string given diff --git a/Zend/tests/enum/backed-duplicate-string.phpt b/Zend/tests/enum/backed-duplicate-string.phpt index 22224ada35a3..d7ae7b309df4 100644 --- a/Zend/tests/enum/backed-duplicate-string.phpt +++ b/Zend/tests/enum/backed-duplicate-string.phpt @@ -12,31 +12,31 @@ enum Suit: string { try { var_dump(Suit::Hearts); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Suit::Hearts); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Suit::from(42)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Suit::tryFrom('bar')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Duplicate value in enum Suit for cases Hearts and Spades -Duplicate value in enum Suit for cases Hearts and Spades -Duplicate value in enum Suit for cases Hearts and Spades -Duplicate value in enum Suit for cases Hearts and Spades +Error: Duplicate value in enum Suit for cases Hearts and Spades +Error: Duplicate value in enum Suit for cases Hearts and Spades +Error: Duplicate value in enum Suit for cases Hearts and Spades +Error: Duplicate value in enum Suit for cases Hearts and Spades diff --git a/Zend/tests/enum/backed-from-invalid-int.phpt b/Zend/tests/enum/backed-from-invalid-int.phpt index d40cae30e6c8..21584621a09d 100644 --- a/Zend/tests/enum/backed-from-invalid-int.phpt +++ b/Zend/tests/enum/backed-from-invalid-int.phpt @@ -10,10 +10,10 @@ enum Foo: int { try { var_dump(Foo::from(2)); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -2 is not a valid backing value for enum Foo +ValueError: 2 is not a valid backing value for enum Foo diff --git a/Zend/tests/enum/backed-from-invalid-string.phpt b/Zend/tests/enum/backed-from-invalid-string.phpt index c6d784872ef0..10949c80cad0 100644 --- a/Zend/tests/enum/backed-from-invalid-string.phpt +++ b/Zend/tests/enum/backed-from-invalid-string.phpt @@ -12,10 +12,10 @@ enum Suit: string { try { var_dump(Suit::from('A')); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -"A" is not a valid backing value for enum Suit +ValueError: "A" is not a valid backing value for enum Suit diff --git a/Zend/tests/enum/backed-from-invalid-type.phpt b/Zend/tests/enum/backed-from-invalid-type.phpt index b4e0e6d6164f..0d1eeab4297f 100644 --- a/Zend/tests/enum/backed-from-invalid-type.phpt +++ b/Zend/tests/enum/backed-from-invalid-type.phpt @@ -12,8 +12,8 @@ enum Suit: string { try { var_dump(Suit::from(42)); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } enum Foo: int { @@ -23,12 +23,12 @@ enum Foo: int { try { var_dump(Foo::from('H')); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -"42" is not a valid backing value for enum Suit -Foo::from(): Argument #1 ($value) must be of type int, string given +ValueError: "42" is not a valid backing value for enum Suit +TypeError: Foo::from(): Argument #1 ($value) must be of type int, string given diff --git a/Zend/tests/enum/backed-mismatch.phpt b/Zend/tests/enum/backed-mismatch.phpt index 73602f7b15b4..6864e51c5698 100644 --- a/Zend/tests/enum/backed-mismatch.phpt +++ b/Zend/tests/enum/backed-mismatch.phpt @@ -9,26 +9,26 @@ enum Foo: int { try { var_dump(Foo::Bar); -} catch (Error $e) { - echo get_class($e), ': ', $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::Bar); -} catch (Error $e) { - echo get_class($e), ': ', $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::from(42)); -} catch (Error $e) { - echo get_class($e), ': ', $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::from('bar')); -} catch (Error $e) { - echo get_class($e), ': ', $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/enum/enum-as-params.phpt b/Zend/tests/enum/enum-as-params.phpt index 90a1f0b5d07f..abef7cebd94d 100644 --- a/Zend/tests/enum/enum-as-params.phpt +++ b/Zend/tests/enum/enum-as-params.phpt @@ -19,17 +19,17 @@ takesBaz(Baz::Qux); try { takesBaz(Foo::Bar); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { takesFoo(Baz::Qux); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -takesBaz(): Argument #1 ($baz) must be of type Baz, Foo given, called in %s on line %d -takesFoo(): Argument #1 ($foo) must be of type Foo, Baz given, called in %s on line %d +TypeError: takesBaz(): Argument #1 ($baz) must be of type Baz, Foo given, called in %s on line %d +TypeError: takesFoo(): Argument #1 ($foo) must be of type Foo, Baz given, called in %s on line %d diff --git a/Zend/tests/enum/internal_enums.phpt b/Zend/tests/enum/internal_enums.phpt index ae26e24cd7ea..c58cdb302da2 100644 --- a/Zend/tests/enum/internal_enums.phpt +++ b/Zend/tests/enum/internal_enums.phpt @@ -33,8 +33,8 @@ var_dump(unserialize($s) === $foo); function test_int_enum(int|string $case) { try { var_dump(ZendTestIntEnum::from($case)); - } catch (\Error $e) { - echo get_class($e) . ': ' . $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(ZendTestIntEnum::tryFrom($case)); } diff --git a/Zend/tests/enum/internal_enums_strict_types.phpt b/Zend/tests/enum/internal_enums_strict_types.phpt index 3d5ea231a271..f98945f72ee4 100644 --- a/Zend/tests/enum/internal_enums_strict_types.phpt +++ b/Zend/tests/enum/internal_enums_strict_types.phpt @@ -11,18 +11,18 @@ var_dump(ZendTestStringEnum::from("Test2")); try { var_dump(ZendTestStringEnum::from(42)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ZendTestStringEnum::tryFrom(43)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- enum(ZendTestStringEnum::Bar) -ZendTestStringEnum::from(): Argument #1 ($value) must be of type string, int given -ZendTestStringEnum::tryFrom(): Argument #1 ($value) must be of type string, int given +TypeError: ZendTestStringEnum::from(): Argument #1 ($value) must be of type string, int given +TypeError: ZendTestStringEnum::tryFrom(): Argument #1 ($value) must be of type string, int given diff --git a/Zend/tests/enum/json_encode.phpt b/Zend/tests/enum/json_encode.phpt index f1174db7ae8e..9328ea99dd7d 100644 --- a/Zend/tests/enum/json_encode.phpt +++ b/Zend/tests/enum/json_encode.phpt @@ -34,8 +34,8 @@ function test($value) { try { var_dump(json_encode($value, JSON_THROW_ON_ERROR)); echo json_last_error_msg() . "\n"; - } catch (Exception $e) { - echo get_class($e) . ': ' . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/enum/no-clone-internal.phpt b/Zend/tests/enum/no-clone-internal.phpt index 84b7ee2634d2..ad2b42793b76 100644 --- a/Zend/tests/enum/no-clone-internal.phpt +++ b/Zend/tests/enum/no-clone-internal.phpt @@ -7,10 +7,10 @@ zend_test try { var_dump(clone ZendTestIntEnum::Foo); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Trying to clone an uncloneable object of class ZendTestIntEnum +Error: Trying to clone an uncloneable object of class ZendTestIntEnum diff --git a/Zend/tests/enum/no-clone.phpt b/Zend/tests/enum/no-clone.phpt index 2fadbb26b720..f5e3573bf440 100644 --- a/Zend/tests/enum/no-clone.phpt +++ b/Zend/tests/enum/no-clone.phpt @@ -9,10 +9,10 @@ enum Foo { try { var_dump(clone Foo::Bar); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Trying to clone an uncloneable object of class Foo +Error: Trying to clone an uncloneable object of class Foo diff --git a/Zend/tests/enum/no-dynamic-properties-internal.phpt b/Zend/tests/enum/no-dynamic-properties-internal.phpt index 8d821a5f6292..1c9eae019cf2 100644 --- a/Zend/tests/enum/no-dynamic-properties-internal.phpt +++ b/Zend/tests/enum/no-dynamic-properties-internal.phpt @@ -9,10 +9,10 @@ $bar = ZendTestUnitEnum::Bar; try { $bar->baz = 'Baz'; -} catch (\Error $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property ZendTestUnitEnum::$baz +Error: Cannot create dynamic property ZendTestUnitEnum::$baz diff --git a/Zend/tests/enum/no-dynamic-properties.phpt b/Zend/tests/enum/no-dynamic-properties.phpt index 83d0d441b458..3654f1a33c6c 100644 --- a/Zend/tests/enum/no-dynamic-properties.phpt +++ b/Zend/tests/enum/no-dynamic-properties.phpt @@ -11,10 +11,10 @@ $bar = Foo::Bar; try { $bar->baz = 'Baz'; -} catch (\Error $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property Foo::$baz +Error: Cannot create dynamic property Foo::$baz diff --git a/Zend/tests/enum/no-new-through-reflection.phpt b/Zend/tests/enum/no-new-through-reflection.phpt index 9a92559cd3d6..c9e0fae4632e 100644 --- a/Zend/tests/enum/no-new-through-reflection.phpt +++ b/Zend/tests/enum/no-new-through-reflection.phpt @@ -7,10 +7,10 @@ enum Foo {} try { (new \ReflectionClass(Foo::class))->newInstanceWithoutConstructor(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot instantiate enum Foo +Error: Cannot instantiate enum Foo diff --git a/Zend/tests/enum/no-new.phpt b/Zend/tests/enum/no-new.phpt index 698e9548827f..6e39f95b4936 100644 --- a/Zend/tests/enum/no-new.phpt +++ b/Zend/tests/enum/no-new.phpt @@ -7,10 +7,10 @@ enum Foo {} try { new Foo(); -} catch (\Error $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot instantiate enum Foo +Error: Cannot instantiate enum Foo diff --git a/Zend/tests/enum/no-pass-properties-by-ref.phpt b/Zend/tests/enum/no-pass-properties-by-ref.phpt index 21c3a41e9352..748b33b69f3c 100644 --- a/Zend/tests/enum/no-pass-properties-by-ref.phpt +++ b/Zend/tests/enum/no-pass-properties-by-ref.phpt @@ -14,13 +14,13 @@ function setBarValueByRef(&$bar, $value) { try { $bar = Foo::Bar; $value = setBarValueByRef($bar->value, 1); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::Bar->value); ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$value +Error: Cannot indirectly modify readonly property Foo::$value int(0) diff --git a/Zend/tests/enum/no-return-properties-by-ref.phpt b/Zend/tests/enum/no-return-properties-by-ref.phpt index ea68e7a585cc..578643bf2736 100644 --- a/Zend/tests/enum/no-return-properties-by-ref.phpt +++ b/Zend/tests/enum/no-return-properties-by-ref.phpt @@ -15,13 +15,13 @@ function &getBarValueByRef() { try { $value = &getBarValueByRef(); $value = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::Bar->value); ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$value +Error: Cannot indirectly modify readonly property Foo::$value int(0) diff --git a/Zend/tests/enum/no-unset-propertes.phpt b/Zend/tests/enum/no-unset-propertes.phpt index 867c853afa76..e73e1ce2dd91 100644 --- a/Zend/tests/enum/no-unset-propertes.phpt +++ b/Zend/tests/enum/no-unset-propertes.phpt @@ -14,24 +14,24 @@ enum IntFoo: int { $foo = Foo::Bar; try { unset($foo->name); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $intFoo = IntFoo::Bar; try { unset($intFoo->name); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($intFoo->value); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot unset readonly property Foo::$name -Cannot unset readonly property IntFoo::$name -Cannot unset readonly property IntFoo::$value +Error: Cannot unset readonly property Foo::$name +Error: Cannot unset readonly property IntFoo::$name +Error: Cannot unset readonly property IntFoo::$value diff --git a/Zend/tests/enum/no-write-properties-cache-slot.phpt b/Zend/tests/enum/no-write-properties-cache-slot.phpt index d59268b6912e..574095207f7c 100644 --- a/Zend/tests/enum/no-write-properties-cache-slot.phpt +++ b/Zend/tests/enum/no-write-properties-cache-slot.phpt @@ -15,13 +15,13 @@ enum Test { try { Test::A->modify(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Test::A->name); ?> --EXPECT-- string(1) "A" -Cannot modify readonly property Test::$name +Error: Cannot modify readonly property Test::$name string(1) "A" diff --git a/Zend/tests/enum/no-write-properties-through-foreach-reference.phpt b/Zend/tests/enum/no-write-properties-through-foreach-reference.phpt index b02f49932904..3f04caddad54 100644 --- a/Zend/tests/enum/no-write-properties-through-foreach-reference.phpt +++ b/Zend/tests/enum/no-write-properties-through-foreach-reference.phpt @@ -10,13 +10,13 @@ enum Foo: int { try { $bar = Foo::Bar; foreach ([1] as &$bar->value) {} -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::Bar->value); ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$value +Error: Cannot indirectly modify readonly property Foo::$value int(0) diff --git a/Zend/tests/enum/no-write-properties-through-references.phpt b/Zend/tests/enum/no-write-properties-through-references.phpt index 17bd57b82ea2..7166b4037631 100644 --- a/Zend/tests/enum/no-write-properties-through-references.phpt +++ b/Zend/tests/enum/no-write-properties-through-references.phpt @@ -11,13 +11,13 @@ try { $bar = Foo::Bar; $value = &$bar->value; $value = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::Bar->value); ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$value +Error: Cannot indirectly modify readonly property Foo::$value int(0) diff --git a/Zend/tests/enum/no-write-properties.phpt b/Zend/tests/enum/no-write-properties.phpt index e0022cfffe76..f64360125427 100644 --- a/Zend/tests/enum/no-write-properties.phpt +++ b/Zend/tests/enum/no-write-properties.phpt @@ -14,36 +14,36 @@ enum IntFoo: int { $bar = Foo::Bar; try { $bar->name = 'Baz'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $bar->value = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $intBar = IntFoo::Bar; try { $intBar->name = 'Baz'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $intBar->value = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $intBar->value2 = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property Foo::$name -Cannot create dynamic property Foo::$value -Cannot modify readonly property IntFoo::$name -Cannot modify readonly property IntFoo::$value -Cannot create dynamic property IntFoo::$value2 +Error: Cannot modify readonly property Foo::$name +Error: Cannot create dynamic property Foo::$value +Error: Cannot modify readonly property IntFoo::$name +Error: Cannot modify readonly property IntFoo::$value +Error: Cannot create dynamic property IntFoo::$value2 diff --git a/Zend/tests/errmsg/bug43344_1.phpt b/Zend/tests/errmsg/bug43344_1.phpt index d517373d9f17..6b9a5604d698 100644 --- a/Zend/tests/errmsg/bug43344_1.phpt +++ b/Zend/tests/errmsg/bug43344_1.phpt @@ -18,28 +18,28 @@ function f3($a=array(bar=>0)) { try { echo bar."\n"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo f1()."\n"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo f2()."\n"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo f3()."\n"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "Foo\bar" -Undefined constant "Foo\bar" -Undefined constant "Foo\bar" -Undefined constant "Foo\bar" +Error: Undefined constant "Foo\bar" +Error: Undefined constant "Foo\bar" +Error: Undefined constant "Foo\bar" +Error: Undefined constant "Foo\bar" diff --git a/Zend/tests/errmsg/errmsg_020.phpt b/Zend/tests/errmsg/errmsg_020.phpt index 4a7c326d0531..80cd072f5409 100644 --- a/Zend/tests/errmsg/errmsg_020.phpt +++ b/Zend/tests/errmsg/errmsg_020.phpt @@ -7,10 +7,10 @@ disable_functions=phpinfo try { phpinfo(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to undefined function phpinfo() +Error: Call to undefined function phpinfo() diff --git a/Zend/tests/error_reporting/bug72162.phpt b/Zend/tests/error_reporting/bug72162.phpt index 721b0fc30680..24011a7caa5a 100644 --- a/Zend/tests/error_reporting/bug72162.phpt +++ b/Zend/tests/error_reporting/bug72162.phpt @@ -7,9 +7,9 @@ $var11 = new StdClass(); try { $var16 = error_reporting($var11); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -error_reporting(): Argument #1 ($error_level) must be of type ?int, stdClass given +TypeError: error_reporting(): Argument #1 ($error_level) must be of type ?int, stdClass given diff --git a/Zend/tests/eval_constant_resolution.phpt b/Zend/tests/eval_constant_resolution.phpt index d302d50a2c05..44bbe4b24bcd 100644 --- a/Zend/tests/eval_constant_resolution.phpt +++ b/Zend/tests/eval_constant_resolution.phpt @@ -20,4 +20,4 @@ Outside eval bool(true) bool(true) string(4) "test" -bool(true) \ No newline at end of file +bool(true) diff --git a/Zend/tests/exception_set_previous_leak.phpt b/Zend/tests/exception_set_previous_leak.phpt index 7fb680f95168..7ff1ad36ff6d 100644 --- a/Zend/tests/exception_set_previous_leak.phpt +++ b/Zend/tests/exception_set_previous_leak.phpt @@ -11,10 +11,10 @@ try { } finally { throw $e; } -} catch (Exception $e2) { - echo $e2->getMessage(), "\n"; +} catch (Throwable $e2) { + echo $e2::class, ': ', $e2->getMessage(), "\n"; } ?> --EXPECT-- -Test +Exception: Test diff --git a/Zend/tests/exception_stream_wrapper.phpt b/Zend/tests/exception_stream_wrapper.phpt index 4de8274fe0c1..2db7364f476b 100644 --- a/Zend/tests/exception_stream_wrapper.phpt +++ b/Zend/tests/exception_stream_wrapper.phpt @@ -20,8 +20,8 @@ class Loader { stream_wrapper_register('abc', 'Loader'); try { require 'abc://'; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -29,4 +29,4 @@ try { stream_set_option stream_stat stream_read -Message +Exception: Message diff --git a/Zend/tests/exceptions/bug26698.phpt b/Zend/tests/exceptions/bug26698.phpt index 8155f2090595..c96ffcfa1cb2 100644 --- a/Zend/tests/exceptions/bug26698.phpt +++ b/Zend/tests/exceptions/bug26698.phpt @@ -24,9 +24,9 @@ class Proxy $res = new ObjectOne(); $this->three($res->getNone()); } - catch(Exception $e) + catch(Throwable $e) { - echo 'Caught: '.$e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -37,9 +37,9 @@ class Proxy $res = new ObjectOne(); $this->three(1, $res->getNone()); } - catch(Exception $e) + catch(Throwable $e) { - echo 'Caught: '.$e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -50,9 +50,9 @@ class Proxy $res = new ObjectOne(); $this->three(1, 2, $res->getNone()); } - catch(Exception $e) + catch(Throwable $e) { - echo 'Caught: '.$e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -64,6 +64,6 @@ $p->callTwo(); $p->callThree(); ?> --EXPECT-- -Caught: NONE -Caught: NONE -Caught: NONE +Exception: NONE +Exception: NONE +Exception: NONE diff --git a/Zend/tests/exceptions/bug47771.phpt b/Zend/tests/exceptions/bug47771.phpt index c4350b9d95d3..edf1f2e79064 100644 --- a/Zend/tests/exceptions/bug47771.phpt +++ b/Zend/tests/exceptions/bug47771.phpt @@ -22,8 +22,8 @@ try { $T =new Test(throw_exc()); -} catch( Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; +} catch( Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/Zend/tests/exceptions/bug48428.phpt b/Zend/tests/exceptions/bug48428.phpt index 0cda84dea4ee..85e98713d1d4 100644 --- a/Zend/tests/exceptions/bug48428.phpt +++ b/Zend/tests/exceptions/bug48428.phpt @@ -5,9 +5,9 @@ Bug #48428 (crash when exception is thrown while passing function arguments) try { function x() { throw new Exception("ERROR"); } x(x()); -} catch(Exception $e) { - echo($e -> getMessage()); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ERROR +Exception: ERROR diff --git a/Zend/tests/exceptions/bug50383.phpt b/Zend/tests/exceptions/bug50383.phpt index 2f72ea51f853..ee97a7bca9bb 100644 --- a/Zend/tests/exceptions/bug50383.phpt +++ b/Zend/tests/exceptions/bug50383.phpt @@ -22,21 +22,21 @@ function thrower2() { try { thrower(); -} catch(Exception $e) { - print $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(); print_r($e->getTrace()); } try { thrower2(); -} catch (Exception $e) { - print $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(); print_r($e->getTrace()); } ?> --EXPECTF-- -Missing static method 'ThrowException' +Exception: Missing static method 'ThrowException' Array ( [0] => Array @@ -69,7 +69,7 @@ Array ) ) -Missing method 'foo' +Exception: Missing method 'foo' Array ( [0] => Array diff --git a/Zend/tests/exceptions/bug53511.phpt b/Zend/tests/exceptions/bug53511.phpt index b07504506a94..1fde070b7069 100644 --- a/Zend/tests/exceptions/bug53511.phpt +++ b/Zend/tests/exceptions/bug53511.phpt @@ -12,8 +12,8 @@ function test() { $e = new Foo(); try { throw new Exception("ops 2"); - } catch (Exception $e) { - echo $e->getMessage()."\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/exceptions/bug54043.phpt b/Zend/tests/exceptions/bug54043.phpt index c6e08b75f9ee..15c481456a6e 100644 --- a/Zend/tests/exceptions/bug54043.phpt +++ b/Zend/tests/exceptions/bug54043.phpt @@ -8,13 +8,13 @@ $timeZone = new DateTimeZone('UTC'); try { $dateTime = new DateTime($time, $timeZone); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(error_get_last()); ?> --EXPECT-- -string(80) "Failed to parse time string (9999-11-33) at position 9 (3): Unexpected character" +DateMalformedStringException: Failed to parse time string (9999-11-33) at position 9 (3): Unexpected character NULL diff --git a/Zend/tests/exceptions/bug60569.phpt b/Zend/tests/exceptions/bug60569.phpt index ef3bea8edb78..6ecfc26e7dd6 100644 --- a/Zend/tests/exceptions/bug60569.phpt +++ b/Zend/tests/exceptions/bug60569.phpt @@ -5,10 +5,11 @@ Bug #60569 (Nullbyte truncates Exception $message.) try { $msg = "Some error \x00 message"; throw new Exception($msg); -} catch(Exception $e) { - var_dump($e->getMessage(), $msg); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; + var_dump($msg); } ?> --EXPECTF-- -string(20) "Some error %0 message" +Exception: Some error %0 message string(20) "Some error %0 message" diff --git a/Zend/tests/exceptions/exception_001.phpt b/Zend/tests/exceptions/exception_001.phpt index aba29d4aa3ee..7b795518a56a 100644 --- a/Zend/tests/exceptions/exception_001.phpt +++ b/Zend/tests/exceptions/exception_001.phpt @@ -8,29 +8,29 @@ try { try { try { throw new Exception(); - } catch (Exception $e) { - var_dump($e->getMessage()); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; throw $e; } - } catch (Exception $e) { - var_dump($e->getMessage()); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; throw $e; } - } catch (Exception $e) { - var_dump($e->getMessage()); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; throw $e; } -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; throw $e; } ?> --EXPECTF-- -string(0) "" -string(0) "" -string(0) "" -string(0) "" +Exception: +Exception: +Exception: +Exception: Fatal error: Uncaught Exception in %s:%d Stack trace: diff --git a/Zend/tests/exceptions/exception_013.phpt b/Zend/tests/exceptions/exception_013.phpt index 93d85761764b..f643ea4324ab 100644 --- a/Zend/tests/exceptions/exception_013.phpt +++ b/Zend/tests/exceptions/exception_013.phpt @@ -8,30 +8,28 @@ class C { try { var_dump(C::$a); -} catch (Error $e) { - echo "\nException: " . $e->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"; } try { var_dump(C::$p); -} catch (Error $e) { - echo "\nException: " . $e->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"; } try { unset(C::$a); -} catch (Error $e) { - echo "\nException: " . $e->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"; } var_dump(C::$a); ?> --EXPECTF-- -Exception: Access to undeclared static property C::$a in %s on line %d - -Exception: Cannot access private property C::$p in %sexception_013.php on line 13 - -Exception: Attempt to unset static property C::$a in %sexception_013.php on line 19 +Error: Access to undeclared static property C::$a in %s on line %d +Error: Cannot access private property C::$p in %sexception_013.php on line 13 +Error: Attempt to unset static property C::$a in %sexception_013.php on line 19 Fatal error: Uncaught Error: Access to undeclared static property C::$a in %s:%d Stack trace: diff --git a/Zend/tests/exceptions/exception_014.phpt b/Zend/tests/exceptions/exception_014.phpt index aaf411dae56c..f9b69cf3aa8f 100644 --- a/Zend/tests/exceptions/exception_014.phpt +++ b/Zend/tests/exceptions/exception_014.phpt @@ -9,14 +9,14 @@ class C { $x = new C; try { var_dump($x->p); -} catch (Error $e) { - echo "\nException: " . $e->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"; } var_dump($x->p); ?> --EXPECTF-- -Exception: Cannot access private property C::$p in %sexception_014.php on line %d +Error: Cannot access private property C::$p in %sexception_014.php on line %d Fatal error: Uncaught Error: Cannot access private property C::$p in %sexception_014.php:%d Stack trace: diff --git a/Zend/tests/exceptions/exception_015.phpt b/Zend/tests/exceptions/exception_015.phpt index a2b27154f657..e98fd4873760 100644 --- a/Zend/tests/exceptions/exception_015.phpt +++ b/Zend/tests/exceptions/exception_015.phpt @@ -5,14 +5,14 @@ Exceptions on improper access to string $s = "ABC"; try { $s[] = "D"; -} catch (Error $e) { - echo "\nException: " . $e->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"; } $s[] = "D"; ?> --EXPECTF-- -Exception: [] operator not supported for strings in %sexception_015.php on line %d +Error: [] operator not supported for strings in %sexception_015.php on line %d Fatal error: Uncaught Error: [] operator not supported for strings in %sexception_015.php:%d Stack trace: diff --git a/Zend/tests/exceptions/exception_016.phpt b/Zend/tests/exceptions/exception_016.phpt index 5b52cf72cd7a..dedae5e179f1 100644 --- a/Zend/tests/exceptions/exception_016.phpt +++ b/Zend/tests/exceptions/exception_016.phpt @@ -4,14 +4,14 @@ Exceptions on improper usage of $this foo(); -} catch (Error $e) { - echo "\nException: " . $e->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"; } $this->foo(); ?> --EXPECTF-- -Exception: Using $this when not in object context in %sexception_016.php on line %d +Error: Using $this when not in object context in %sexception_016.php on line %d Fatal error: Uncaught Error: Using $this when not in object context in %sexception_016.php:%d Stack trace: diff --git a/Zend/tests/exceptions/exception_before_fatal.phpt b/Zend/tests/exceptions/exception_before_fatal.phpt index edc63b2394cd..cd0c2d518a8a 100644 --- a/Zend/tests/exceptions/exception_before_fatal.phpt +++ b/Zend/tests/exceptions/exception_before_fatal.phpt @@ -11,38 +11,38 @@ set_error_handler("exception_error_handler"); try { $foo->a(); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new $foo(); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw $foo; } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $foo(); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $foo::b(); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $b = clone $foo; } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } class b { @@ -51,14 +51,14 @@ class b { try { b::$foo(); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(23) "Undefined variable $foo" -string(23) "Undefined variable $foo" -string(23) "Undefined variable $foo" -string(23) "Undefined variable $foo" -string(23) "Undefined variable $foo" -string(23) "Undefined variable $foo" -string(23) "Undefined variable $foo" +Exception: Undefined variable $foo +Exception: Undefined variable $foo +Exception: Undefined variable $foo +Exception: Undefined variable $foo +Exception: Undefined variable $foo +Exception: Undefined variable $foo +Exception: Undefined variable $foo diff --git a/Zend/tests/exceptions/exception_during_by_reference_magic_get.phpt b/Zend/tests/exceptions/exception_during_by_reference_magic_get.phpt index 5732e8cc5af7..26fb7a8d1694 100644 --- a/Zend/tests/exceptions/exception_during_by_reference_magic_get.phpt +++ b/Zend/tests/exceptions/exception_during_by_reference_magic_get.phpt @@ -14,10 +14,10 @@ $test = new Test; $y = 5; try { $test->x =& $y; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Foobar +Exception: Foobar diff --git a/Zend/tests/exceptions/exception_during_include_stat.phpt b/Zend/tests/exceptions/exception_during_include_stat.phpt index 62747384e713..444416679714 100644 --- a/Zend/tests/exceptions/exception_during_include_stat.phpt +++ b/Zend/tests/exceptions/exception_during_include_stat.phpt @@ -15,28 +15,28 @@ set_include_path('test://foo:test://bar'); try { require_once 'doesnt_exist.php'; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { require 'doesnt_exist.php'; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { include_once 'doesnt_exist.php'; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { include 'doesnt_exist.php'; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -stat failed -stat failed -stat failed -stat failed +Exception: stat failed +Exception: stat failed +Exception: stat failed +Exception: stat failed diff --git a/Zend/tests/exceptions/exception_from_toString.phpt b/Zend/tests/exceptions/exception_from_toString.phpt index dd4de341caf2..5a559fff5b15 100644 --- a/Zend/tests/exceptions/exception_from_toString.phpt +++ b/Zend/tests/exceptions/exception_from_toString.phpt @@ -14,78 +14,78 @@ $num = 42; $badStr = new BadStr; try { $x = $str . $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = $badStr . $str; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = $str .= $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); try { $x = $num . $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = $badStr . $num; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = $num .= $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($num); try { $x = $badStr .= $str; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($badStr); try { $x = $badStr .= $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($badStr); try { $x = "x$badStr"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "{$badStr}x"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "$str$badStr"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "$badStr$str"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "x$badStr$str"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "x$str$badStr"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "{$str}x$badStr"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = "{$badStr}x$str"; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = (string) $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = include $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ${""} = 42; try { unset(${$badStr}); } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(${""}); unset(${""}); try { $x = ${$badStr}; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x = isset(${$badStr}); } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } $obj = new stdClass; try { $x = $obj->{$badStr} = $str; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($obj); try { $str[0] = $badStr; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str); $obj = new DateInterval('P1D'); try { $x = $obj->{$badStr} = $str; } -catch (Exception $e) { echo $e->getMessage(), "\n"; } +catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(!isset($obj->{""})); try { strlen($badStr); } catch (Exception $e) { echo "Exception\n"; } @@ -94,41 +94,41 @@ try { new ArrayObject([], 0, $badStr); } catch (Exception $e) { echo "Exception\ ?> --EXPECT-- -Exception -Exception -Exception +Exception: Exception +Exception: Exception +Exception: Exception string(1) "a" -Exception -Exception -Exception +Exception: Exception +Exception: Exception +Exception: Exception int(42) -Exception +Exception: Exception object(BadStr)#1 (0) { } -Exception +Exception: Exception object(BadStr)#1 (0) { } -Exception -Exception -Exception -Exception -Exception -Exception -Exception -Exception -Exception -Exception -Exception -Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception +Exception: Exception int(42) -Exception -Exception -Exception +Exception: Exception +Exception: Exception +Exception: Exception object(stdClass)#2 (0) { } -Exception +Exception: Exception string(1) "a" -Exception +Exception: Exception bool(true) Exception Exception diff --git a/Zend/tests/exceptions/exception_handler/exception_handler_004.phpt b/Zend/tests/exceptions/exception_handler/exception_handler_004.phpt index a9f9e77a59d9..4ff3c5f189fc 100644 --- a/Zend/tests/exceptions/exception_handler/exception_handler_004.phpt +++ b/Zend/tests/exceptions/exception_handler/exception_handler_004.phpt @@ -5,16 +5,16 @@ exception handler tests - 4 try { set_exception_handler("fo"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { set_exception_handler(array("", "")); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -set_exception_handler(): Argument #1 ($callback) must be a valid callback or null, function "fo" not found or invalid function name -set_exception_handler(): Argument #1 ($callback) must be a valid callback or null, class "" not found +TypeError: set_exception_handler(): Argument #1 ($callback) must be a valid callback or null, function "fo" not found or invalid function name +TypeError: set_exception_handler(): Argument #1 ($callback) must be a valid callback or null, class "" not found diff --git a/Zend/tests/exit/die_string_cast_exception.phpt b/Zend/tests/exit/die_string_cast_exception.phpt index c20a873939df..e23e9ca55f96 100644 --- a/Zend/tests/exit/die_string_cast_exception.phpt +++ b/Zend/tests/exit/die_string_cast_exception.phpt @@ -5,10 +5,10 @@ Bug #79777: String cast exception during die should be handled gracefully try { die(new stdClass); -} catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -exit(): Argument #1 ($status) must be of type string|int, stdClass given +TypeError: exit(): Argument #1 ($status) must be of type string|int, stdClass given diff --git a/Zend/tests/exit_finally_2.phpt b/Zend/tests/exit_finally_2.phpt index 0a3f5dc7a1d1..448dc90ace29 100644 --- a/Zend/tests/exit_finally_2.phpt +++ b/Zend/tests/exit_finally_2.phpt @@ -14,8 +14,8 @@ try { throw new Exception("Finally exception"); } echo "Not executed\n"; -} catch (Exception $e) { - echo "Caught {$e->getMessage()}\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/fe_fetch_dtor_exception.phpt b/Zend/tests/fe_fetch_dtor_exception.phpt index 99378e739a8b..95ecfe4d2b05 100644 --- a/Zend/tests/fe_fetch_dtor_exception.phpt +++ b/Zend/tests/fe_fetch_dtor_exception.phpt @@ -13,10 +13,10 @@ try { foreach ([1, 2] as $v) { var_dump($v); } -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -foo +Exception: foo diff --git a/Zend/tests/fe_fetch_op2_live_range.phpt b/Zend/tests/fe_fetch_op2_live_range.phpt index c601e43120e0..7ddfc9378cdd 100644 --- a/Zend/tests/fe_fetch_op2_live_range.phpt +++ b/Zend/tests/fe_fetch_op2_live_range.phpt @@ -4,9 +4,9 @@ FE_FETCH op2 is a def and needs special live range handling func()[]) {} -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to undefined function func() +Error: Call to undefined function func() diff --git a/Zend/tests/fibers/catch.phpt b/Zend/tests/fibers/catch.phpt index 92c139ca1b4d..a55541b6acbf 100644 --- a/Zend/tests/fibers/catch.phpt +++ b/Zend/tests/fibers/catch.phpt @@ -6,8 +6,8 @@ Catch exception thrown into fiber $fiber = new Fiber(function () { try { Fiber::suspend('test'); - } catch (Exception $exception) { - var_dump($exception->getMessage()); + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } }); @@ -19,4 +19,4 @@ $fiber->throw(new Exception('test')); ?> --EXPECT-- string(4) "test" -string(4) "test" +Exception: test diff --git a/Zend/tests/fibers/fiber-error-construct.phpt b/Zend/tests/fibers/fiber-error-construct.phpt index 8af23ff86ebd..a8b4fd02a634 100644 --- a/Zend/tests/fibers/fiber-error-construct.phpt +++ b/Zend/tests/fibers/fiber-error-construct.phpt @@ -5,10 +5,10 @@ FiberError cannot be constructed in user code try { new FiberError; -} catch (Error $exception) { - echo $exception->getMessage(), "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -The "FiberError" class is reserved for internal use and cannot be manually instantiated +Error: The "FiberError" class is reserved for internal use and cannot be manually instantiated diff --git a/Zend/tests/fibers/get-return-after-throwing.phpt b/Zend/tests/fibers/get-return-after-throwing.phpt index 620f74e3239c..a46b00d27cb9 100644 --- a/Zend/tests/fibers/get-return-after-throwing.phpt +++ b/Zend/tests/fibers/get-return-after-throwing.phpt @@ -7,15 +7,15 @@ $fiber = new Fiber(fn() => throw new Exception('test')); try { $fiber->start(); -} catch (Exception $exception) { - echo $exception->getMessage(), "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $fiber->getReturn(); ?> --EXPECTF-- -test +Exception: test Fatal error: Uncaught FiberError: Cannot get fiber return value: The fiber threw an exception in %sget-return-after-throwing.php:%d Stack trace: diff --git a/Zend/tests/fibers/gh10249.phpt b/Zend/tests/fibers/gh10249.phpt index efbef9c42a2e..2f9f9b4f9c84 100644 --- a/Zend/tests/fibers/gh10249.phpt +++ b/Zend/tests/fibers/gh10249.phpt @@ -8,10 +8,10 @@ ini_set("fiber.stack_size", ""); $fiber = new Fiber($callback); try { $fiber->start(); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Fiber stack size is too small, it needs to be at least %d bytes +Exception: Fiber stack size is too small, it needs to be at least %d bytes diff --git a/Zend/tests/fibers/gh20483.phpt b/Zend/tests/fibers/gh20483.phpt index e06cf87258ea..0181606412b8 100644 --- a/Zend/tests/fibers/gh20483.phpt +++ b/Zend/tests/fibers/gh20483.phpt @@ -8,9 +8,9 @@ $callback = function () {}; $fiber = new Fiber($callback); try { $fiber->start(); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Fiber stack size is too small, it needs to be at least %d bytes +Exception: Fiber stack size is too small, it needs to be at least %d bytes diff --git a/Zend/tests/fibers/negative_stack_size.phpt b/Zend/tests/fibers/negative_stack_size.phpt index 591a8f28878d..c75686b89186 100644 --- a/Zend/tests/fibers/negative_stack_size.phpt +++ b/Zend/tests/fibers/negative_stack_size.phpt @@ -7,7 +7,7 @@ $fiber = new Fiber(function() {}); try { $fiber->start(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> DONE diff --git a/Zend/tests/fibers/suspend-in-force-close-fiber-catching-exception.phpt b/Zend/tests/fibers/suspend-in-force-close-fiber-catching-exception.phpt index dfde978ce06b..a00484feb3fa 100644 --- a/Zend/tests/fibers/suspend-in-force-close-fiber-catching-exception.phpt +++ b/Zend/tests/fibers/suspend-in-force-close-fiber-catching-exception.phpt @@ -15,13 +15,13 @@ try { $fiber->start(); })(); -} catch (FiberError $exception) { - echo $exception->getMessage(), "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "done\n"; ?> --EXPECT-- -Cannot suspend in a force-closed fiber +FiberError: Cannot suspend in a force-closed fiber done diff --git a/Zend/tests/fibers/unfinished-fiber-with-throw-in-finally.phpt b/Zend/tests/fibers/unfinished-fiber-with-throw-in-finally.phpt index f1b17caeb5d7..c4ab9ef3f640 100644 --- a/Zend/tests/fibers/unfinished-fiber-with-throw-in-finally.phpt +++ b/Zend/tests/fibers/unfinished-fiber-with-throw-in-finally.phpt @@ -19,16 +19,16 @@ $fiber = new Fiber(function (): void { echo "inner finally\n"; throw new \Exception("finally exception"); } - } catch (Exception $exception) { - echo $exception->getMessage(), "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } finally { echo "outer finally\n"; } try { echo Fiber::suspend(); - } catch (FiberError $exception) { - echo $exception->getMessage(), "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } }); @@ -42,7 +42,7 @@ echo "done\n"; --EXPECT-- fiber inner finally -finally exception +Exception: finally exception outer finally -Cannot suspend in a force-closed fiber +FiberError: Cannot suspend in a force-closed fiber done diff --git a/Zend/tests/first_class_callable/constexpr/attributes_ast_printing.phpt b/Zend/tests/first_class_callable/constexpr/attributes_ast_printing.phpt index 2916c3dfff86..8d2e3d00bb45 100644 --- a/Zend/tests/first_class_callable/constexpr/attributes_ast_printing.phpt +++ b/Zend/tests/first_class_callable/constexpr/attributes_ast_printing.phpt @@ -11,8 +11,8 @@ try { #[Attr(strrev(...))] function () { } ); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -21,13 +21,13 @@ try { new #[Attr(strrev(...))] class {} ); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(!#[Attr(strrev(...))] function () { +AssertionError: assert(!#[Attr(strrev(...))] function () { }) -assert(!new #[Attr(strrev(...))] class { +AssertionError: assert(!new #[Attr(strrev(...))] class { }) diff --git a/Zend/tests/first_class_callable/constexpr/error_static_call_trait_method_002.phpt b/Zend/tests/first_class_callable/constexpr/error_static_call_trait_method_002.phpt index 97831a8d65f0..30bd7011c4e3 100644 --- a/Zend/tests/first_class_callable/constexpr/error_static_call_trait_method_002.phpt +++ b/Zend/tests/first_class_callable/constexpr/error_static_call_trait_method_002.phpt @@ -21,11 +21,11 @@ function foo(Closure $c = Foo::myMethod(...)) { try { foo(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Caught: Calling static trait method Foo::myMethod is deprecated, it should only be called on a class using the trait +ErrorException: Calling static trait method Foo::myMethod is deprecated, it should only be called on a class using the trait diff --git a/Zend/tests/first_class_callable/first_class_callable_015.phpt b/Zend/tests/first_class_callable/first_class_callable_015.phpt index 72e1d413dd70..545be8944a42 100644 --- a/Zend/tests/first_class_callable/first_class_callable_015.phpt +++ b/Zend/tests/first_class_callable/first_class_callable_015.phpt @@ -14,11 +14,11 @@ $fn = test(...); do_weak_call($fn); try { do_strict_call($fn); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- int(42) -test(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: test(): Argument #1 ($i) must be of type int, string given, called in %s on line %d diff --git a/Zend/tests/first_class_callable/first_class_callable_assert.phpt b/Zend/tests/first_class_callable/first_class_callable_assert.phpt index 2bf3d9fc69e2..78cff4b9d0f3 100644 --- a/Zend/tests/first_class_callable/first_class_callable_assert.phpt +++ b/Zend/tests/first_class_callable/first_class_callable_assert.phpt @@ -9,17 +9,17 @@ $assert = assert(...); $assert(1 == 1.0, "Message 1"); try { $assert(1 == 2.0, "Message 2"); -} catch (\AssertionError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && strlen(...)); -} catch (\AssertionError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Message 2 -assert(false && strlen(...)) +AssertionError: Message 2 +AssertionError: assert(false && strlen(...)) diff --git a/Zend/tests/first_class_callable/first_class_callable_errors.phpt b/Zend/tests/first_class_callable/first_class_callable_errors.phpt index dffcd779f361..4e7503027b14 100644 --- a/Zend/tests/first_class_callable/first_class_callable_errors.phpt +++ b/Zend/tests/first_class_callable/first_class_callable_errors.phpt @@ -12,46 +12,46 @@ class Test { try { $fn = 123; $fn(...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { does_not_exist(...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { stdClass::doesNotExist(...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (new stdClass)->doesNotExist(...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { [new stdClass, 'doesNotExist'](...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Test::privateMethod(...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Test::instanceMethod(...); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Value of type int is not callable -Call to undefined function does_not_exist() -Call to undefined method stdClass::doesNotExist() -Call to undefined method stdClass::doesNotExist() -Call to undefined method stdClass::doesNotExist() -Call to private method Test::privateMethod() from global scope -Non-static method Test::instanceMethod() cannot be called statically +Error: Value of type int is not callable +Error: Call to undefined function does_not_exist() +Error: Call to undefined method stdClass::doesNotExist() +Error: Call to undefined method stdClass::doesNotExist() +Error: Call to undefined method stdClass::doesNotExist() +Error: Call to private method Test::privateMethod() from global scope +Error: Non-static method Test::instanceMethod() cannot be called statically diff --git a/Zend/tests/foreach/foreach_003.phpt b/Zend/tests/foreach/foreach_003.phpt index 3ecb96de7951..73999b398473 100644 --- a/Zend/tests/foreach/foreach_003.phpt +++ b/Zend/tests/foreach/foreach_003.phpt @@ -30,42 +30,42 @@ foreach(['rewind', 'valid', 'key', 'current', 'next'] as $trap) { try { // IS_CV foreach ($obj as $key => $val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($obj); try { // IS_VAR foreach (new IT(3, $trap) as $key => $val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // IS_TMP_VAR foreach ((object)new IT(2, $trap) as $key => $val) echo "$val\n"; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -rewind -rewind -rewind -valid -valid -valid -key -key -key -current -current -current +Exception: rewind +Exception: rewind +Exception: rewind +Exception: valid +Exception: valid +Exception: valid +Exception: key +Exception: key +Exception: key +Exception: current +Exception: current +Exception: current 0 -next +Exception: next 0 -next +Exception: next 0 -next +Exception: next diff --git a/Zend/tests/frameless_undefined_var.phpt b/Zend/tests/frameless_undefined_var.phpt index e9c5aac58236..5fcf5e006278 100644 --- a/Zend/tests/frameless_undefined_var.phpt +++ b/Zend/tests/frameless_undefined_var.phpt @@ -10,9 +10,9 @@ function test() { } try { test(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined variable $foo +Exception: Undefined variable $foo diff --git a/Zend/tests/func_arg_fetch_optimization.phpt b/Zend/tests/func_arg_fetch_optimization.phpt index ba01d8f7dee9..1401292bb126 100644 --- a/Zend/tests/func_arg_fetch_optimization.phpt +++ b/Zend/tests/func_arg_fetch_optimization.phpt @@ -7,9 +7,9 @@ function test($x) { } try { test([]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot use [] for reading +Error: Cannot use [] for reading diff --git a/Zend/tests/func_get_arg_basic.phpt b/Zend/tests/func_get_arg_basic.phpt index ec06a5c20f4d..5e56aa415603 100644 --- a/Zend/tests/func_get_arg_basic.phpt +++ b/Zend/tests/func_get_arg_basic.phpt @@ -6,50 +6,50 @@ func_get_arg() tests function test1() { try { var_dump(func_get_arg(-10)); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(func_get_arg(0)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(func_get_arg(1)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } function test2($a) { try { var_dump(func_get_arg(0)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(func_get_arg(1)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } function test3($a, $b) { try { var_dump(func_get_arg(0)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(func_get_arg(1)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(func_get_arg(2)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -59,7 +59,7 @@ test2(1); try { test2(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } test3(1,2); @@ -67,7 +67,7 @@ call_user_func("test1"); try { call_user_func("test3", 1); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } call_user_func("test3", 1, 2); @@ -75,13 +75,13 @@ class test { static function test1($a) { try { var_dump(func_get_arg(0)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(func_get_arg(1)); - } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -89,33 +89,33 @@ class test { test::test1(1); try { var_dump(func_get_arg(1)); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- -func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 +ValueError: func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ValueError: func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 int(10) -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function int(1) -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -Exception: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ArgumentCountError: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected int(1) int(2) -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ValueError: func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ArgumentCountError: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected int(1) int(2) -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function int(1) -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function -func_get_arg() cannot be called from the global scope +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +Error: func_get_arg() cannot be called from the global scope Done diff --git a/Zend/tests/func_get_arg_invalid.phpt b/Zend/tests/func_get_arg_invalid.phpt index 13e0443c07f6..e08eaa2ef75a 100644 --- a/Zend/tests/func_get_arg_invalid.phpt +++ b/Zend/tests/func_get_arg_invalid.phpt @@ -5,8 +5,8 @@ func_get_arg() invalid usage try { var_dump(func_get_arg(1)); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function bar() { @@ -19,11 +19,11 @@ function foo() { try { foo(1,2); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -func_get_arg() cannot be called from the global scope -func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function +Error: func_get_arg() cannot be called from the global scope +ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function diff --git a/Zend/tests/func_get_args.phpt b/Zend/tests/func_get_args.phpt index 33cfdb02ebcd..0c61755a8758 100644 --- a/Zend/tests/func_get_args.phpt +++ b/Zend/tests/func_get_args.phpt @@ -5,10 +5,10 @@ Testing func_get_args() throws error when called from the global scope try { func_get_args(); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -func_get_args() cannot be called from the global scope +Error: func_get_args() cannot be called from the global scope diff --git a/Zend/tests/func_get_args_basic.phpt b/Zend/tests/func_get_args_basic.phpt index 54ddf1b40c92..a6278cdb067b 100644 --- a/Zend/tests/func_get_args_basic.phpt +++ b/Zend/tests/func_get_args_basic.phpt @@ -21,7 +21,7 @@ test2(1); try { test2(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } test3(1,2); @@ -29,7 +29,7 @@ call_user_func("test1"); try { call_user_func("test3", 1); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } call_user_func("test3", 1, 2); @@ -43,8 +43,8 @@ test::test1(1); try { var_dump(func_get_args()); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -59,7 +59,7 @@ array(1) { [0]=> int(1) } -Exception: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected +ArgumentCountError: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected array(2) { [0]=> int(1) @@ -68,7 +68,7 @@ array(2) { } array(0) { } -Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected +ArgumentCountError: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected array(2) { [0]=> int(1) @@ -79,4 +79,4 @@ array(1) { [0]=> int(1) } -func_get_args() cannot be called from the global scope +Error: func_get_args() cannot be called from the global scope diff --git a/Zend/tests/func_num_args_basic.phpt b/Zend/tests/func_num_args_basic.phpt index 0e27b48d6501..c0293f8d1b59 100644 --- a/Zend/tests/func_num_args_basic.phpt +++ b/Zend/tests/func_num_args_basic.phpt @@ -20,7 +20,7 @@ test2(1); try { test2(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } test3(1,2); @@ -29,7 +29,7 @@ call_user_func("test1"); try { call_user_func("test3", 1); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } call_user_func("test3", 1, 2); @@ -43,8 +43,8 @@ test::test1(1); try { func_num_args(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; @@ -52,11 +52,11 @@ echo "Done\n"; --EXPECTF-- int(0) int(1) -Exception: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected +ArgumentCountError: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected int(2) int(0) -Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected +ArgumentCountError: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected int(2) int(1) -func_num_args() must be called from a function context +Error: func_num_args() must be called from a function context Done diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt index d23a6a0c7057..b286298178ad 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt @@ -4,9 +4,9 @@ Call internal function with incorrect number of arguments getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -substr() expects at least 2 arguments, 1 given +ArgumentCountError: substr() expects at least 2 arguments, 1 given diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt index 2b809cdb731a..c2b63e6664f8 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt @@ -5,20 +5,16 @@ Call internal function with incorrect number of arguments with strict types declare(strict_types=1); try { substr("foo"); -} catch (ArgumentCountError $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_diff(); -} catch (ArgumentCountError $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ArgumentCountError -substr() expects at least 2 arguments, 1 given -ArgumentCountError -array_diff() expects at least 1 argument, 0 given +ArgumentCountError: substr() expects at least 2 arguments, 1 given +ArgumentCountError: array_diff() expects at least 1 argument, 0 given diff --git a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt index db9be6d85140..ddfd342d41d6 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt @@ -5,41 +5,33 @@ Call userland function with incorrect number of arguments try { function foo($bar) { } foo(); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { function bar($foo, $bar) { } bar(1); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function bat(int $foo, string $bar) { } try { bat(123); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bat("123"); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -ArgumentCountError -Too few arguments to function foo(), 0 passed in %s and exactly 1 expected -ArgumentCountError -Too few arguments to function bar(), 1 passed in %s and exactly 2 expected -ArgumentCountError -Too few arguments to function bat(), 1 passed in %s and exactly 2 expected -ArgumentCountError -Too few arguments to function bat(), 1 passed in %s and exactly 2 expected +ArgumentCountError: Too few arguments to function foo(), 0 passed in %s and exactly 1 expected +ArgumentCountError: Too few arguments to function bar(), 1 passed in %s and exactly 2 expected +ArgumentCountError: Too few arguments to function bat(), 1 passed in %s and exactly 2 expected +ArgumentCountError: Too few arguments to function bat(), 1 passed in %s and exactly 2 expected diff --git a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt index 2a67a9ce4c6b..d8703181bf60 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt @@ -6,50 +6,40 @@ declare(strict_types=1); try { function foo($bar) { } foo(); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { function bar($foo, $bar) { } bar(1); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function bat(int $foo, string $bar) { } try { bat(123); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bat("123"); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bat(123, 456); -} catch (\Error $e) { - echo get_class($e) . PHP_EOL; - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -ArgumentCountError -Too few arguments to function foo(), 0 passed in %s and exactly 1 expected -ArgumentCountError -Too few arguments to function bar(), 1 passed in %s and exactly 2 expected -ArgumentCountError -Too few arguments to function bat(), 1 passed in %s and exactly 2 expected -TypeError -bat(): Argument #1 ($foo) must be of type int, string given, called in %s on line %d -TypeError -bat(): Argument #2 ($bar) must be of type string, int given, called in %s on line %d +ArgumentCountError: Too few arguments to function foo(), 0 passed in %s and exactly 1 expected +ArgumentCountError: Too few arguments to function bar(), 1 passed in %s and exactly 2 expected +ArgumentCountError: Too few arguments to function bat(), 1 passed in %s and exactly 2 expected +TypeError: bat(): Argument #1 ($foo) must be of type int, string given, called in %s on line %d +TypeError: bat(): Argument #2 ($bar) must be of type string, int given, called in %s on line %d diff --git a/Zend/tests/function_arguments/sensitive_parameter_correctly_captures_original.phpt b/Zend/tests/function_arguments/sensitive_parameter_correctly_captures_original.phpt index 1a6dc97dd2e4..1fe2b6fef4cd 100644 --- a/Zend/tests/function_arguments/sensitive_parameter_correctly_captures_original.phpt +++ b/Zend/tests/function_arguments/sensitive_parameter_correctly_captures_original.phpt @@ -14,8 +14,8 @@ function test( try { test('foo', 'bar', 'baz'); echo 'Not reached'; -} catch (Exception $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; $testFrame = $e->getTrace()[0]; var_dump($testFrame['function']); var_dump(count($testFrame['args'])); @@ -36,8 +36,8 @@ function test2( try { test2('foo', 'variadic1', 'variadic2', 'variadic3'); echo 'Not reached'; -} catch (Exception $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; $testFrame = $e->getTrace()[0]; var_dump($testFrame['function']); var_dump(count($testFrame['args'])); @@ -53,14 +53,14 @@ try { ?> --EXPECTF-- -Error +Exception: Error string(4) "test" int(3) string(3) "foo" string(3) "bar" string(3) "baz" Success -Error 2 +Exception: Error 2 string(5) "test2" int(4) string(3) "foo" From 541b0490497db0fcc7688f3fad335c93d93e9be7 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 22 Aug 2026 01:05:21 +0700 Subject: [PATCH 2/2] fix: made empty line explicit --- Zend/tests/exceptions/exception_001.phpt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Zend/tests/exceptions/exception_001.phpt b/Zend/tests/exceptions/exception_001.phpt index 7b795518a56a..51953c964fbc 100644 --- a/Zend/tests/exceptions/exception_001.phpt +++ b/Zend/tests/exceptions/exception_001.phpt @@ -9,28 +9,28 @@ try { try { throw new Exception(); } catch (Throwable $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; + echo $e::class, ': "', $e->getMessage(), '"', "\n"; throw $e; } } catch (Throwable $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; + echo $e::class, ': "', $e->getMessage(), '"', "\n"; throw $e; } } catch (Throwable $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; + echo $e::class, ': "', $e->getMessage(), '"', "\n"; throw $e; } } catch (Throwable $e) { - echo $e::class, ': ', $e->getMessage(), "\n"; + echo $e::class, ': "', $e->getMessage(), '"', "\n"; throw $e; } ?> --EXPECTF-- -Exception: -Exception: -Exception: -Exception: +Exception: "" +Exception: "" +Exception: "" +Exception: "" Fatal error: Uncaught Exception in %s:%d Stack trace: