From e47c4cda4ee55fd9f38ed6b02e99c34bc9934a81 Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Sat, 22 Aug 2026 17:38:30 +0800 Subject: [PATCH 01/27] [skip ci] UPGRADING: Add missing entry for MYSQLI_OPT_COMPRESS This adds the missing entry for MYSQLI_OPT_COMPRESS added in commit 724ff60 --- UPGRADING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UPGRADING b/UPGRADING index d8fc594e82f8..b55cb53a2bad 100644 --- a/UPGRADING +++ b/UPGRADING @@ -757,6 +757,9 @@ PHP 8.6 UPGRADE NOTES . CURL_SEEKFUNC_CANTSEEK. . CURL_READFUNC_ABORT. +- MySQLi: + . MYSQLI_OPT_COMPRESS. + - OpenSSL: . OPENSSL_RSA_PSS_SALTLEN_DIGEST. . OPENSSL_RSA_PSS_SALTLEN_AUTO. From 0fadb1949a021030dcbebcb2a1f042f1a9995a00 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 19:45:05 +0700 Subject: [PATCH 02/27] ext/gettext: applied fixers to improve test robustness (#23028) --- ext/gettext/tests/44938.phpt | 90 +++++++++---------- ext/gettext/tests/dcgettext_lcall.phpt | 12 +-- ext/gettext/tests/dcngettext.phpt | 12 +-- ...ettext_bind_textdomain_codeset-retval.phpt | 12 +-- .../gettext_bindtextdomain-emptydomain.phpt | 6 +- .../tests/gettext_textdomain-retval.phpt | 12 +-- ext/gettext/tests/gh17400.phpt | 6 +- 7 files changed, 75 insertions(+), 75 deletions(-) diff --git a/ext/gettext/tests/44938.phpt b/ext/gettext/tests/44938.phpt index faaeea6a2a5b..3b6727ced561 100644 --- a/ext/gettext/tests/44938.phpt +++ b/ext/gettext/tests/44938.phpt @@ -11,108 +11,108 @@ $category = "cat"; try { bindtextdomain($overflown, 'path'); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dngettext($overflown, $msgid, $msgid, 1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dngettext($domain, $overflown, $msgid, 1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dngettext($domain, $msgid, $overflown, 1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { gettext($overflown); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { ngettext($overflown, $msgid, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { ngettext($msgid, $overflown, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dcgettext($overflown, $msgid, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dcgettext($domain, $overflown, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dcngettext($overflown, $msgid, $msgid, -1, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dcngettext($domain, $overflown, $msgid, -1, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dcngettext($domain, $msgid, $overflown, -1, -1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dgettext($overflown, $msgid); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { dgettext($domain, $overflown); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { textdomain($overflown); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -bindtextdomain(): Argument #1 ($domain) is too long -dngettext(): Argument #1 ($domain) is too long -dngettext(): Argument #2 ($singular) is too long -dngettext(): Argument #3 ($plural) is too long -gettext(): Argument #1 ($message) is too long -ngettext(): Argument #1 ($singular) is too long -ngettext(): Argument #2 ($plural) is too long -dcgettext(): Argument #1 ($domain) is too long -dcgettext(): Argument #2 ($message) is too long -dcngettext(): Argument #1 ($domain) is too long -dcngettext(): Argument #2 ($singular) is too long -dcngettext(): Argument #3 ($plural) is too long -dgettext(): Argument #1 ($domain) is too long -dgettext(): Argument #2 ($message) is too long -textdomain(): Argument #1 ($domain) is too long +ValueError: bindtextdomain(): Argument #1 ($domain) is too long +ValueError: dngettext(): Argument #1 ($domain) is too long +ValueError: dngettext(): Argument #2 ($singular) is too long +ValueError: dngettext(): Argument #3 ($plural) is too long +ValueError: gettext(): Argument #1 ($message) is too long +ValueError: ngettext(): Argument #1 ($singular) is too long +ValueError: ngettext(): Argument #2 ($plural) is too long +ValueError: dcgettext(): Argument #1 ($domain) is too long +ValueError: dcgettext(): Argument #2 ($message) is too long +ValueError: dcngettext(): Argument #1 ($domain) is too long +ValueError: dcngettext(): Argument #2 ($singular) is too long +ValueError: dcngettext(): Argument #3 ($plural) is too long +ValueError: dgettext(): Argument #1 ($domain) is too long +ValueError: dgettext(): Argument #2 ($message) is too long +ValueError: textdomain(): Argument #1 ($domain) is too long diff --git a/ext/gettext/tests/dcgettext_lcall.phpt b/ext/gettext/tests/dcgettext_lcall.phpt index 004ae89409ec..b73ca3fb168c 100644 --- a/ext/gettext/tests/dcgettext_lcall.phpt +++ b/ext/gettext/tests/dcgettext_lcall.phpt @@ -6,16 +6,16 @@ gettext getMessage() . PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { dcngettext('dngettextTest', 'item', 'item2', 1, LC_ALL); -} catch (ValueError $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -dcgettext(): Argument #3 ($category) cannot be LC_ALL -dcngettext(): Argument #5 ($category) cannot be LC_ALL +ValueError: dcgettext(): Argument #3 ($category) cannot be LC_ALL +ValueError: dcngettext(): Argument #5 ($category) cannot be LC_ALL diff --git a/ext/gettext/tests/dcngettext.phpt b/ext/gettext/tests/dcngettext.phpt index 16258d678015..46950e157c99 100644 --- a/ext/gettext/tests/dcngettext.phpt +++ b/ext/gettext/tests/dcngettext.phpt @@ -16,14 +16,14 @@ var_dump(dcngettext("test","test","test",-1,-1)); try { dcngettext("","","",1,1); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { dcngettext("","","",0,1); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; @@ -33,6 +33,6 @@ string(1) "1" string(4) "test" string(4) "test" string(4) "test" -dcngettext(): Argument #1 ($domain) must not be empty -dcngettext(): Argument #1 ($domain) must not be empty +ValueError: dcngettext(): Argument #1 ($domain) must not be empty +ValueError: dcngettext(): Argument #1 ($domain) must not be empty Done diff --git a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt index bba70c9848e9..15149deb40a6 100644 --- a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt +++ b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt @@ -6,14 +6,14 @@ gettext getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bind_textdomain_codeset("", "UTF-8"); - } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // bind_textdomain_codeset() always returns false on musl @@ -29,8 +29,8 @@ gettext echo "Done\n"; ?> --EXPECT-- -bind_textdomain_codeset(): Argument #1 ($domain) must not be empty -bind_textdomain_codeset(): Argument #1 ($domain) must not be empty +ValueError: bind_textdomain_codeset(): Argument #1 ($domain) must not be empty +ValueError: bind_textdomain_codeset(): Argument #1 ($domain) must not be empty bool(true) Done --CREDITS-- diff --git a/ext/gettext/tests/gettext_bindtextdomain-emptydomain.phpt b/ext/gettext/tests/gettext_bindtextdomain-emptydomain.phpt index 607460b3c2db..51ef2d6fd704 100644 --- a/ext/gettext/tests/gettext_bindtextdomain-emptydomain.phpt +++ b/ext/gettext/tests/gettext_bindtextdomain-emptydomain.phpt @@ -9,13 +9,13 @@ chdir(__DIR__); try { bindtextdomain('', 'foobar'); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -bindtextdomain(): Argument #1 ($domain) must not be empty +ValueError: bindtextdomain(): Argument #1 ($domain) must not be empty --CREDITS-- Till Klampaeckel, till@php.net PHP Testfest Berlin 2009-05-09 diff --git a/ext/gettext/tests/gettext_textdomain-retval.phpt b/ext/gettext/tests/gettext_textdomain-retval.phpt index 2f2f52d37743..735b08530d63 100644 --- a/ext/gettext/tests/gettext_textdomain-retval.phpt +++ b/ext/gettext/tests/gettext_textdomain-retval.phpt @@ -21,22 +21,22 @@ echo textdomain('foo'), "\n"; try { textdomain('0'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { textdomain(''); -} catch (\ValueError $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- test test foo -textdomain(): Argument #1 ($domain) cannot be zero -textdomain(): Argument #1 ($domain) must not be empty +ValueError: textdomain(): Argument #1 ($domain) cannot be zero +ValueError: textdomain(): Argument #1 ($domain) must not be empty --CREDITS-- Christian Weiske, cweiske@php.net PHP Testfest Berlin 2009-05-09 diff --git a/ext/gettext/tests/gh17400.phpt b/ext/gettext/tests/gh17400.phpt index 836b792bf0de..df3fa634830c 100644 --- a/ext/gettext/tests/gh17400.phpt +++ b/ext/gettext/tests/gh17400.phpt @@ -11,9 +11,9 @@ $utf16le_char_bad = pack("H*", "00dc00dc"); try { bindtextdomain($utf16le_char_bad,$utf16_first_le); -} catch (\ValueError $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bindtextdomain(): Argument #1 ($domain) must not contain any null bytes +ValueError: bindtextdomain(): Argument #1 ($domain) must not contain any null bytes From 8f67c41e29d4862ba215245006a7ef68ab22bb4f Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 19:45:49 +0700 Subject: [PATCH 03/27] ext/ffi: applied fixers to improve test robustness (#23131) --- ext/ffi/tests/003.phpt | 4 ++-- ext/ffi/tests/004.phpt | 4 ++-- ext/ffi/tests/008.phpt | 4 ++-- ext/ffi/tests/010.phpt | 2 +- ext/ffi/tests/012.phpt | 2 +- ext/ffi/tests/013.phpt | 14 +++++------ ext/ffi/tests/014.phpt | 2 +- ext/ffi/tests/015.phpt | 16 ++++++------- ext/ffi/tests/016.phpt | 6 ++--- ext/ffi/tests/017.phpt | 6 ++--- ext/ffi/tests/018.phpt | 4 ++-- ext/ffi/tests/019.phpt | 4 ++-- ext/ffi/tests/020.phpt | 14 +++++------ ext/ffi/tests/023.phpt | 2 +- ext/ffi/tests/027.phpt | 24 +++++++++---------- ext/ffi/tests/028.phpt | 12 +++++----- ext/ffi/tests/031.phpt | 2 +- ext/ffi/tests/035.phpt | 2 +- ext/ffi/tests/045.phpt | 4 ++-- ext/ffi/tests/047.phpt | 6 ++--- ext/ffi/tests/bug77706.phpt | 8 +++---- ext/ffi/tests/bug78761.phpt | 6 ++--- ext/ffi/tests/bug78762.phpt | 6 ++--- ext/ffi/tests/bug79576.phpt | 6 ++--- ext/ffi/tests/deprecations.phpt | 18 +++++++------- ext/ffi/tests/gh14286_2.phpt | 4 ++-- ext/ffi/tests/gh16397.phpt | 6 ++--- ext/ffi/tests/gh18629_cdef_resolve_func.phpt | 6 ++--- .../tests/gh18629_read_field_non_struct.phpt | 6 ++--- ext/ffi/tests/gh9698.phpt | 5 ++-- 30 files changed, 103 insertions(+), 102 deletions(-) diff --git a/ext/ffi/tests/003.phpt b/ext/ffi/tests/003.phpt index d608c013d5a3..fe7e9b86ff89 100644 --- a/ext/ffi/tests/003.phpt +++ b/ext/ffi/tests/003.phpt @@ -32,12 +32,12 @@ var_dump($ffi->new("d")); try { var_dump($ffi->new("struct _e")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($ffi->new("f")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "ok\n"; ?> diff --git a/ext/ffi/tests/004.phpt b/ext/ffi/tests/004.phpt index 6852fe19ee75..1349257e5dce 100644 --- a/ext/ffi/tests/004.phpt +++ b/ext/ffi/tests/004.phpt @@ -42,12 +42,12 @@ var_dump($ffi->new("int[_c4]")); try { var_dump($ffi->new("enum _e")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($ffi->new("f")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "ok\n"; ?> diff --git a/ext/ffi/tests/008.phpt b/ext/ffi/tests/008.phpt index 9ad015eac54b..480eff70e9e4 100644 --- a/ext/ffi/tests/008.phpt +++ b/ext/ffi/tests/008.phpt @@ -20,7 +20,7 @@ $a = $ffi->new("struct {int x,y;}"); try { var_dump(count($a)); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -28,7 +28,7 @@ try { echo "$key => $val\n"; } } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/010.phpt b/ext/ffi/tests/010.phpt index ea17aef08c5d..a3275e018d1e 100644 --- a/ext/ffi/tests/010.phpt +++ b/ext/ffi/tests/010.phpt @@ -11,4 +11,4 @@ FFI::memset($a, ord("a"), FFI::sizeof($a)); var_dump(FFI::string($a, FFI::sizeof($a))); ?> --EXPECT-- -string(12) "aaaaaaaaaaaa" \ No newline at end of file +string(12) "aaaaaaaaaaaa" diff --git a/ext/ffi/tests/012.phpt b/ext/ffi/tests/012.phpt index 8695b0ca0170..d33940ae732e 100644 --- a/ext/ffi/tests/012.phpt +++ b/ext/ffi/tests/012.phpt @@ -9,7 +9,7 @@ ffi.enable=1 try { var_dump(serialize(FFI::cdef()->new("int[2]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/013.phpt b/ext/ffi/tests/013.phpt index dc8b99c1d71f..2d8906b08b0f 100644 --- a/ext/ffi/tests/013.phpt +++ b/ext/ffi/tests/013.phpt @@ -16,43 +16,43 @@ var_dump(count($a[0][0])); try { var_dump($ffi->new("void")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($ffi->new("void[1]")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("static int foo(int)[5];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("static int foo[5](int);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("static int foo(int)(int);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("typedef int foo[2][];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("typedef int foo[][2];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/014.phpt b/ext/ffi/tests/014.phpt index d0f877e7a7f2..98c70be33dc6 100644 --- a/ext/ffi/tests/014.phpt +++ b/ext/ffi/tests/014.phpt @@ -17,4 +17,4 @@ ok int(8) int(8) int(16) -ok \ No newline at end of file +ok diff --git a/ext/ffi/tests/015.phpt b/ext/ffi/tests/015.phpt index de48105faa11..ccb7b699b11c 100644 --- a/ext/ffi/tests/015.phpt +++ b/ext/ffi/tests/015.phpt @@ -10,49 +10,49 @@ try { FFI::cdef("struct DIR; static struct DIR dir;"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; static struct DIR *ptr;"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR dir;"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR *ptr;"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; static struct DIR foo();"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; static struct DIR* foo();"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; static void foo(struct DIR);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct DIR; static void foo(struct DIR*);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ok diff --git a/ext/ffi/tests/016.phpt b/ext/ffi/tests/016.phpt index 8a4326bb4d50..4581856e0ad8 100644 --- a/ext/ffi/tests/016.phpt +++ b/ext/ffi/tests/016.phpt @@ -10,19 +10,19 @@ try { FFI::cdef("struct X {void x();};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct X {struct X x;};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct X {struct X *ptr;};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ok diff --git a/ext/ffi/tests/017.phpt b/ext/ffi/tests/017.phpt index 30f1efdde66c..af268da21a1c 100644 --- a/ext/ffi/tests/017.phpt +++ b/ext/ffi/tests/017.phpt @@ -9,17 +9,17 @@ ffi.enable=1 try { var_dump(FFI::new("struct X {void x();}")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(FFI::new("struct X {struct X x;}")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(FFI::new("struct X {struct X *ptr;}")); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ok diff --git a/ext/ffi/tests/018.phpt b/ext/ffi/tests/018.phpt index 76ab23e08dac..902cf9cdba76 100644 --- a/ext/ffi/tests/018.phpt +++ b/ext/ffi/tests/018.phpt @@ -10,13 +10,13 @@ try { FFI::cdef("struct X {struct X x[2];};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct X {struct X *ptr[2];};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ok diff --git a/ext/ffi/tests/019.phpt b/ext/ffi/tests/019.phpt index 867c10556d4b..f07f7d382ee9 100644 --- a/ext/ffi/tests/019.phpt +++ b/ext/ffi/tests/019.phpt @@ -10,13 +10,13 @@ try { FFI::cdef("static int foo(int[]);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("static int foo(int bar(int));"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ok diff --git a/ext/ffi/tests/020.phpt b/ext/ffi/tests/020.phpt index 37cb6b17d116..aecc3e2631c1 100644 --- a/ext/ffi/tests/020.phpt +++ b/ext/ffi/tests/020.phpt @@ -14,7 +14,7 @@ try { $p->y = 1; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p = $ffi->new("struct {const int x; int y;}"); @@ -22,35 +22,35 @@ try { $p->x = 1; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p = $ffi->new("const struct {int x; int y;}"); $p->x = 1; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p = $ffi->new("const int[10]"); $p[1] = 1; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p = $ffi->new("const int * [1]"); $p[0] = null; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p = $ffi->new("int * const [1]"); $p[0] = null; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f = FFI::cdef("typedef int * const t[1];"); @@ -58,7 +58,7 @@ try { $p[0] = null; echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ok diff --git a/ext/ffi/tests/023.phpt b/ext/ffi/tests/023.phpt index 9cf77d723b04..c9d9cf1b2829 100644 --- a/ext/ffi/tests/023.phpt +++ b/ext/ffi/tests/023.phpt @@ -11,7 +11,7 @@ ffi.enable=1 try { var_dump(FFI::sizeof($ffi->new("struct {}"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(FFI::sizeof($ffi->new("struct {int a}"))); var_dump(FFI::sizeof($ffi->new("struct {int a; int b}"))); diff --git a/ext/ffi/tests/027.phpt b/ext/ffi/tests/027.phpt index b71bab4001bf..31d18c06b712 100644 --- a/ext/ffi/tests/027.phpt +++ b/ext/ffi/tests/027.phpt @@ -12,70 +12,70 @@ try { $p = $ffi->new("int[*]"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("static int (*foo)[*];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("typedef int foo[*];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("static void foo(int[*][*]);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(FFI::sizeof($ffi->new("int[0]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(FFI::sizeof($ffi->new("int[]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(FFI::sizeof($ffi->cast("int[]", $ffi->new("int[2]")))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct _x {int a; int b[];};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f = FFI::cdef("typedef int(*foo)[];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f = FFI::cdef("typedef int foo[][2];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f = FFI::cdef("typedef int foo[];"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f = FFI::cdef("static int foo(int[]);"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/028.phpt b/ext/ffi/tests/028.phpt index 473980bcd218..13e477a39397 100644 --- a/ext/ffi/tests/028.phpt +++ b/ext/ffi/tests/028.phpt @@ -10,37 +10,37 @@ try { FFI::cdef("struct _x {int a; int b[0];};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct _x {int a; int b[];};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct _x {int a[0]; int b;};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct _x {int a[]; int b;};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("struct _x { struct {int a; int b[];}; int c;};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef("union _x {int a; int b[];};"); echo "ok\n"; } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/031.phpt b/ext/ffi/tests/031.phpt index d4b43f8f6e6d..295155c648b8 100644 --- a/ext/ffi/tests/031.phpt +++ b/ext/ffi/tests/031.phpt @@ -13,7 +13,7 @@ function test_size($expected_size, $type) { echo "FAIL: sizeof($type) != $expected_size ($size)\n"; } } catch (Throwable $e) { - echo $type . "=>" . get_class($e) . ": " . $e->getMessage()."\n"; + echo $type, '=>', $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/ext/ffi/tests/035.phpt b/ext/ffi/tests/035.phpt index bd8c6df71f97..01ccc1eaf4ce 100644 --- a/ext/ffi/tests/035.phpt +++ b/ext/ffi/tests/035.phpt @@ -13,7 +13,7 @@ FFI::free($p); try { var_dump($p); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- diff --git a/ext/ffi/tests/045.phpt b/ext/ffi/tests/045.phpt index 84cecae01562..a4fec1115aeb 100644 --- a/ext/ffi/tests/045.phpt +++ b/ext/ffi/tests/045.phpt @@ -12,12 +12,12 @@ var_dump(FFI::isNull(FFI::addr($i))); try { var_dump(FFI::isNull(null)); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(FFI::isNull(FFI::cdef()->new("int[0]"))); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/047.phpt b/ext/ffi/tests/047.phpt index e09da3fe9eec..48af033eb299 100644 --- a/ext/ffi/tests/047.phpt +++ b/ext/ffi/tests/047.phpt @@ -15,7 +15,7 @@ try { $x->cdata = 42; var_dump($x); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = FFI::cdef()->new("struct {int cdata;}"); @@ -23,7 +23,7 @@ try { $x->cdata = 42; var_dump($x); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -31,7 +31,7 @@ object(FFI\CData:int32_t)#%d (1) { ["cdata"]=> int(42) } -Attempt to assign field 'cdata' of non C struct/union +FFI\Exception: Attempt to assign field 'cdata' of non C struct/union object(FFI\CData:struct )#%d (1) { ["cdata"]=> int(42) diff --git a/ext/ffi/tests/bug77706.phpt b/ext/ffi/tests/bug77706.phpt index 704c4aec5315..1cffbfac3f44 100644 --- a/ext/ffi/tests/bug77706.phpt +++ b/ext/ffi/tests/bug77706.phpt @@ -33,25 +33,25 @@ $ffi = FFI::cdef($header, 'libc.so.6'); try { $ffi->time(); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ffi->time(null, null); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ffi->fprintf($ffi->stdout); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ffi->fprintf($ffi->stdout, 123, "Hello %s\n", "World"); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/ffi/tests/bug78761.phpt b/ext/ffi/tests/bug78761.phpt index fc1c66129114..41e4776aa7ba 100644 --- a/ext/ffi/tests/bug78761.phpt +++ b/ext/ffi/tests/bug78761.phpt @@ -15,9 +15,9 @@ opcache.preload={PWD}/bug78761_preload.php cast('char[10]', FFI::cdef()->new('char[1]')); -} catch (FFI\Exception $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -attempt to cast to larger type +FFI\Exception: attempt to cast to larger type diff --git a/ext/ffi/tests/bug78762.phpt b/ext/ffi/tests/bug78762.phpt index 5c621d3547e8..8619eaf3fc3f 100644 --- a/ext/ffi/tests/bug78762.phpt +++ b/ext/ffi/tests/bug78762.phpt @@ -6,9 +6,9 @@ ffi cast('char[10]', FFI::cdef()->new('char[1]')); -} catch (FFI\Exception $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -attempt to cast to larger type +FFI\Exception: attempt to cast to larger type diff --git a/ext/ffi/tests/bug79576.phpt b/ext/ffi/tests/bug79576.phpt index a5dee75564c6..5712701c2086 100644 --- a/ext/ffi/tests/bug79576.phpt +++ b/ext/ffi/tests/bug79576.phpt @@ -11,12 +11,12 @@ if (PHP_DEBUG || getenv('SKIP_ASAN')) echo "xleak FFI cleanup after parser error try { FFI::cdef('struct tree *get_tree(const oid *, size_t, struct tree *);'); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef('struct tree *get_tree(oid, size_t, struct tree *);'); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FFI::cdef(' @@ -25,7 +25,7 @@ typedef struct _simple_struct { } simple_struct; '); } catch (Throwable $e) { - echo get_class($e) . ": " . $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> DONE diff --git a/ext/ffi/tests/deprecations.phpt b/ext/ffi/tests/deprecations.phpt index d62a214712d0..2ae3a5e93f77 100644 --- a/ext/ffi/tests/deprecations.phpt +++ b/ext/ffi/tests/deprecations.phpt @@ -14,8 +14,8 @@ set_error_handler(function ($severity, $message, $file, $line) { }); try { FFI::new("uint8_t[2]"); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } set_error_handler(null); @@ -28,8 +28,8 @@ set_error_handler(function ($severity, $message, $file, $line) { }); try { FFI::type("uint16_t[2]"); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } set_error_handler(null); @@ -39,14 +39,14 @@ set_error_handler(function ($severity, $message, $file, $line) { }); try { FFI::cast("uint8_t[2]", $p1); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: Calling FFI::new() statically is deprecated in %s on line %d -Calling FFI::new() statically is deprecated +Exception: Calling FFI::new() statically is deprecated object(FFI\CData:uint8_t[2])#1 (2) { [0]=> int(0) @@ -55,7 +55,7 @@ object(FFI\CData:uint8_t[2])#1 (2) { } Deprecated: Calling FFI::type() statically is deprecated in %s on line %d -Calling FFI::type() statically is deprecated +Exception: Calling FFI::type() statically is deprecated Deprecated: Calling FFI::cast() statically is deprecated in %s on line %d -Calling FFI::cast() statically is deprecated +Exception: Calling FFI::cast() statically is deprecated diff --git a/ext/ffi/tests/gh14286_2.phpt b/ext/ffi/tests/gh14286_2.phpt index 4dc48ccc27a1..56fb2559008c 100644 --- a/ext/ffi/tests/gh14286_2.phpt +++ b/ext/ffi/tests/gh14286_2.phpt @@ -14,8 +14,8 @@ try { } x; "); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Failed resolving C variable 'x' +FFI\Exception: Failed resolving C variable 'x' diff --git a/ext/ffi/tests/gh16397.phpt b/ext/ffi/tests/gh16397.phpt index 19ddf7ecc62a..512b831a24ca 100644 --- a/ext/ffi/tests/gh16397.phpt +++ b/ext/ffi/tests/gh16397.phpt @@ -7,9 +7,9 @@ ffi $ffi = FFI::cdef(); try { var_dump($ffi != 1); -} catch (FFI\Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot compare FFI objects +FFI\Exception: Cannot compare FFI objects diff --git a/ext/ffi/tests/gh18629_cdef_resolve_func.phpt b/ext/ffi/tests/gh18629_cdef_resolve_func.phpt index ae81412efa63..8be51dc1d388 100644 --- a/ext/ffi/tests/gh18629_cdef_resolve_func.phpt +++ b/ext/ffi/tests/gh18629_cdef_resolve_func.phpt @@ -8,9 +8,9 @@ ffi.enable=1 getMessage() . "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Failed resolving C function 'nonexistent_ffi_test_func' +FFI\Exception: Failed resolving C function 'nonexistent_ffi_test_func' diff --git a/ext/ffi/tests/gh18629_read_field_non_struct.phpt b/ext/ffi/tests/gh18629_read_field_non_struct.phpt index 307fde1a53b8..3c43c504c050 100644 --- a/ext/ffi/tests/gh18629_read_field_non_struct.phpt +++ b/ext/ffi/tests/gh18629_read_field_non_struct.phpt @@ -9,9 +9,9 @@ ffi.enable=1 $x = FFI::cdef()->new("int*"); try { $y = $x->foo; -} catch (\FFI\Exception $e) { - echo $e->getMessage() . "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attempt to read field 'foo' of non C struct/union +FFI\Exception: Attempt to read field 'foo' of non C struct/union diff --git a/ext/ffi/tests/gh9698.phpt b/ext/ffi/tests/gh9698.phpt index bab403810cd3..952a096e3546 100644 --- a/ext/ffi/tests/gh9698.phpt +++ b/ext/ffi/tests/gh9698.phpt @@ -11,11 +11,12 @@ try { stream_wrapper_register('badffi', 'FFI\CData'); file_get_contents('badffi://x'); } catch (Throwable $exception) { - echo $exception->getMessage(); + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> DONE --EXPECT-- -Attempt to assign field 'context' to uninitialized FFI\CData object +FFI\Exception: Attempt to assign field 'context' to uninitialized FFI\CData object + DONE From ca2f9bce3f1427a5b7a30bcb16c17dd3b9d1c3b6 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 19:49:54 +0700 Subject: [PATCH 04/27] ext/opcache: applied fixers to improve test robustness (#23133) --- ext/opcache/tests/assign_obj_exceptions.phpt | 18 +++++----- .../tests/assign_obj_op_of_fetch_dim.phpt | 6 ++-- ext/opcache/tests/bug68104.phpt | 6 ++-- ext/opcache/tests/bug76796.phpt | 6 ++-- ext/opcache/tests/bug78185.phpt | 1 - .../tests/get_configuration_matches_ini.phpt | 2 +- ext/opcache/tests/gh13817.phpt | 1 - ext/opcache/tests/gh17422/002.phpt | 6 ++-- .../tests/gh20628_borked_live_range_calc.phpt | 4 +-- ext/opcache/tests/inc_array.phpt | 12 +++---- ext/opcache/tests/invalid_new_dce.phpt | 16 ++++----- ext/opcache/tests/issue0057.phpt | 6 ++-- ext/opcache/tests/jit/add_011.phpt | 1 - ext/opcache/tests/jit/add_012.phpt | 2 +- ext/opcache/tests/jit/add_013.phpt | 2 +- ext/opcache/tests/jit/add_014.phpt | 4 +-- ext/opcache/tests/jit/add_015.phpt | 2 +- ext/opcache/tests/jit/assign_018.phpt | 1 - ext/opcache/tests/jit/assign_040.phpt | 6 ++-- ext/opcache/tests/jit/assign_041.phpt | 2 +- ext/opcache/tests/jit/assign_043.phpt | 6 ++-- ext/opcache/tests/jit/assign_044.phpt | 1 - ext/opcache/tests/jit/assign_045.phpt | 1 - ext/opcache/tests/jit/assign_047.phpt | 1 - ext/opcache/tests/jit/assign_053.phpt | 2 +- ext/opcache/tests/jit/assign_dim_002.phpt | 30 ++++++++-------- ext/opcache/tests/jit/assign_dim_003.phpt | 2 +- ext/opcache/tests/jit/assign_dim_011.phpt | 4 +-- ext/opcache/tests/jit/assign_dim_013.phpt | 2 +- ext/opcache/tests/jit/assign_dim_017.phpt | 2 +- ext/opcache/tests/jit/assign_dim_op_001.phpt | 18 +++++----- ext/opcache/tests/jit/assign_dim_op_005.phpt | 12 +++---- .../tests/jit/assign_dim_undef_exception.phpt | 12 +++---- ext/opcache/tests/jit/assign_obj_001.phpt | 12 +++---- ext/opcache/tests/jit/assign_obj_002.phpt | 6 ++-- ext/opcache/tests/jit/assign_obj_003.phpt | 4 +-- ext/opcache/tests/jit/assign_obj_on_null.phpt | 12 +++---- ext/opcache/tests/jit/assign_op_001.phpt | 12 +++---- ext/opcache/tests/jit/assign_op_002.phpt | 2 +- ext/opcache/tests/jit/bind_static.phpt | 6 ++-- ext/opcache/tests/jit/bug80745.phpt | 1 - ext/opcache/tests/jit/bug81409.phpt | 2 +- ext/opcache/tests/jit/bw_not_001.phpt | 2 +- ext/opcache/tests/jit/copy_tmp_002.phpt | 2 +- ext/opcache/tests/jit/count_001.phpt | 2 +- ext/opcache/tests/jit/fe_reset_001.phpt | 1 - ext/opcache/tests/jit/fetch_dim_r_003.phpt | 12 +++---- ext/opcache/tests/jit/fetch_dim_r_004.phpt | 8 ++--- ext/opcache/tests/jit/fetch_dim_r_006.phpt | 2 +- ext/opcache/tests/jit/fetch_obj_001.phpt | 18 +++++----- ext/opcache/tests/jit/fetch_obj_005.phpt | 2 +- ext/opcache/tests/jit/gh12509.phpt | 2 +- ext/opcache/tests/jit/gh12723-A.phpt | 4 +-- ext/opcache/tests/jit/gh12723-B.phpt | 4 +-- ext/opcache/tests/jit/gh12747.phpt | 12 +++---- ext/opcache/tests/jit/gh12748.phpt | 8 ++--- ext/opcache/tests/jit/gh12812.phpt | 4 +-- ext/opcache/tests/jit/gh13772.phpt | 1 - ext/opcache/tests/jit/gh15652.phpt | 2 +- ext/opcache/tests/jit/gh16499.phpt | 2 +- ext/opcache/tests/jit/gh8863.phpt | 6 ++-- ext/opcache/tests/jit/gh9011.phpt | 2 +- ext/opcache/tests/jit/inc_020.phpt | 2 +- ext/opcache/tests/jit/inc_obj_003.phpt | 2 +- ext/opcache/tests/jit/inc_obj_006.phpt | 1 - ext/opcache/tests/jit/init_fcall_001.phpt | 1 - ext/opcache/tests/jit/isset_002.phpt | 2 +- ext/opcache/tests/jit/match_001.phpt | 2 +- ext/opcache/tests/jit/mod_001.phpt | 6 ++-- ext/opcache/tests/jit/mod_002.phpt | 6 ++-- ext/opcache/tests/jit/mod_004.phpt | 2 +- ext/opcache/tests/jit/mod_006.phpt | 2 +- ext/opcache/tests/jit/mod_007.phpt | 2 +- ext/opcache/tests/jit/mul_003.phpt | 2 +- ext/opcache/tests/jit/mul_005.phpt | 6 ++-- ext/opcache/tests/jit/mul_006.phpt | 2 +- ext/opcache/tests/jit/mul_007.phpt | 2 +- ext/opcache/tests/jit/mul_009.phpt | 2 +- ext/opcache/tests/jit/mul_010.phpt | 4 +-- ext/opcache/tests/jit/noval_001.phpt | 1 - ext/opcache/tests/jit/qm_assign_001.phpt | 1 - ext/opcache/tests/jit/qm_assign_002.phpt | 2 +- ext/opcache/tests/jit/qm_assign_003.phpt | 2 +- .../tests/jit/qm_assign_undef_exception.phpt | 6 ++-- .../tests/jit/recursive_wrong_args.phpt | 6 ++-- ext/opcache/tests/jit/recv_002.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_005.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_006.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_010.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_011.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_012.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_013.phpt | 2 +- ext/opcache/tests/jit/reg_alloc_022.phpt | 2 +- ext/opcache/tests/jit/shift_left_001.phpt | 6 ++-- ext/opcache/tests/jit/shift_left_002.phpt | 6 ++-- ext/opcache/tests/jit/shift_right_001.phpt | 8 ++--- ext/opcache/tests/jit/shift_right_002.phpt | 8 ++--- ext/opcache/tests/jit/type_check_001.phpt | 4 +-- ext/opcache/tests/jit/undef_to_typed_ref.phpt | 36 +++++++++---------- .../tests/jit/verify_return_undef.phpt | 6 ++-- ext/opcache/tests/match_always_error.phpt | 6 ++-- ext/opcache/tests/method_call_on_literal.phpt | 6 ++-- ext/opcache/tests/opt/coalesce_002.phpt | 2 +- ext/opcache/tests/opt/gh19792.phpt | 6 ++-- ext/opcache/tests/opt/inference_003.phpt | 1 - ext/opcache/tests/opt/inference_016.phpt | 4 +-- ext/opcache/tests/opt/inference_017.phpt | 4 +-- ext/opcache/tests/opt/inference_018.phpt | 4 +-- ext/opcache/tests/opt/tmp_001.phpt | 2 +- ext/opcache/tests/optimize_static_001.phpt | 4 +-- ext/opcache/tests/preload_004.phpt | 4 +-- ext/opcache/tests/preload_009.phpt | 4 +-- ext/opcache/tests/preload_012.phpt | 4 +-- ext/opcache/tests/ssa_bug_003.phpt | 12 +++---- 114 files changed, 276 insertions(+), 291 deletions(-) diff --git a/ext/opcache/tests/assign_obj_exceptions.phpt b/ext/opcache/tests/assign_obj_exceptions.phpt index ffcebede37b0..f75caab56346 100644 --- a/ext/opcache/tests/assign_obj_exceptions.phpt +++ b/ext/opcache/tests/assign_obj_exceptions.phpt @@ -26,22 +26,22 @@ function test_invalid_obj_type($c) { try { test_invalid_prop_type(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_invalid_prop_name("\0"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_invalid_obj_type(false); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to property Test::$x of type stdClass -Cannot access property starting with "\0" -Attempt to assign property "x" on null +TypeError: Cannot assign string to property Test::$x of type stdClass +Error: Cannot access property starting with "\0" +Error: Attempt to assign property "x" on null diff --git a/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt b/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt index 1f42c3ac2aeb..5f55f1f371a8 100644 --- a/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt +++ b/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt @@ -12,11 +12,11 @@ function test() { } try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined array key 0 in %s on line %d -Attempt to assign property "y" on null +Error: Attempt to assign property "y" on null diff --git a/ext/opcache/tests/bug68104.phpt b/ext/opcache/tests/bug68104.phpt index 00c9551e974c..6c4335adc0cb 100644 --- a/ext/opcache/tests/bug68104.phpt +++ b/ext/opcache/tests/bug68104.phpt @@ -17,10 +17,10 @@ if (getenv('SKIP_ASAN')) die('xleak dl() crashes LSan'); var_dump(is_callable("dl")); try { dl("a.so"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(false) -Call to undefined function dl() +Error: Call to undefined function dl() diff --git a/ext/opcache/tests/bug76796.phpt b/ext/opcache/tests/bug76796.phpt index b9efbc3ce70f..bc10f1fc6289 100644 --- a/ext/opcache/tests/bug76796.phpt +++ b/ext/opcache/tests/bug76796.phpt @@ -12,10 +12,10 @@ opcache try { var_dump(strpos('foo', 'bar')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to undefined function strpos() +Error: Call to undefined function strpos() diff --git a/ext/opcache/tests/bug78185.phpt b/ext/opcache/tests/bug78185.phpt index d8f2b00977ec..b671039a19be 100644 --- a/ext/opcache/tests/bug78185.phpt +++ b/ext/opcache/tests/bug78185.phpt @@ -38,4 +38,3 @@ foreach (glob($pattern) as $p) { ?> --EXPECTF-- string(%d) "%s78185.php.bin" - diff --git a/ext/opcache/tests/get_configuration_matches_ini.phpt b/ext/opcache/tests/get_configuration_matches_ini.phpt index 8e29614acad6..07d7f1044567 100644 --- a/ext/opcache/tests/get_configuration_matches_ini.phpt +++ b/ext/opcache/tests/get_configuration_matches_ini.phpt @@ -14,4 +14,4 @@ var_dump(array_diff_key($inis, $opts)); ?> --EXPECT-- array(0) { -} \ No newline at end of file +} diff --git a/ext/opcache/tests/gh13817.phpt b/ext/opcache/tests/gh13817.phpt index 0e5eb560d46f..140b6d836320 100644 --- a/ext/opcache/tests/gh13817.phpt +++ b/ext/opcache/tests/gh13817.phpt @@ -48,4 +48,3 @@ Ok - diff --git a/ext/opcache/tests/gh17422/002.phpt b/ext/opcache/tests/gh17422/002.phpt index 6145f71a8e58..9d4b1134fe29 100644 --- a/ext/opcache/tests/gh17422/002.phpt +++ b/ext/opcache/tests/gh17422/002.phpt @@ -9,13 +9,13 @@ set_error_handler(static function (int $errno, string $errstr, string $errfile, try { require __DIR__ . "/warning.inc"; -} catch (\Exception $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } warning(); ?> --EXPECT-- -Caught: "continue" targeting switch is equivalent to "break" +ErrorException: "continue" targeting switch is equivalent to "break" OK: warning diff --git a/ext/opcache/tests/gh20628_borked_live_range_calc.phpt b/ext/opcache/tests/gh20628_borked_live_range_calc.phpt index f0b6ccfc92c8..741cb8ea3fff 100644 --- a/ext/opcache/tests/gh20628_borked_live_range_calc.phpt +++ b/ext/opcache/tests/gh20628_borked_live_range_calc.phpt @@ -15,9 +15,9 @@ function test($cond) { try { test(true); } catch (Throwable $e) { - echo $e::class, $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ReflectionExceptionClass "non" does not exist +ReflectionException: Class "non" does not exist diff --git a/ext/opcache/tests/inc_array.phpt b/ext/opcache/tests/inc_array.phpt index 223554448164..0e4201286e65 100644 --- a/ext/opcache/tests/inc_array.phpt +++ b/ext/opcache/tests/inc_array.phpt @@ -13,15 +13,15 @@ function test_inc_partial_array($k) { } try { test_inc_array(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_inc_partial_array(0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot increment array -Cannot increment array +TypeError: Cannot increment array +TypeError: Cannot increment array diff --git a/ext/opcache/tests/invalid_new_dce.phpt b/ext/opcache/tests/invalid_new_dce.phpt index 4f31c8049c9c..d1f38af59a3c 100644 --- a/ext/opcache/tests/invalid_new_dce.phpt +++ b/ext/opcache/tests/invalid_new_dce.phpt @@ -29,14 +29,14 @@ function test4() { $x = new Abc; } -try { test1(); } catch (Error $e) { echo $e->getMessage(), "\n"; } -try { test2(); } catch (Error $e) { echo $e->getMessage(), "\n"; } -try { test3(); } catch (Error $e) { echo $e->getMessage(), "\n"; } -try { test4(); } catch (Error $e) { echo $e->getMessage(), "\n"; } +try { test1(); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } +try { test2(); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } +try { test3(); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } +try { test4(); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot instantiate abstract class Foo -Cannot instantiate interface Bar -Cannot instantiate trait Baz -Cannot declare self-referencing constant Abc::BAR +Error: Cannot instantiate abstract class Foo +Error: Cannot instantiate interface Bar +Error: Cannot instantiate trait Baz +Error: Cannot declare self-referencing constant Abc::BAR diff --git a/ext/opcache/tests/issue0057.phpt b/ext/opcache/tests/issue0057.phpt index ac73859b0d36..87a4e27561ac 100644 --- a/ext/opcache/tests/issue0057.phpt +++ b/ext/opcache/tests/issue0057.phpt @@ -29,10 +29,10 @@ function dummy($query) { try { dummy(0); -} catch (Exception $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -exception +Exception: exception diff --git a/ext/opcache/tests/jit/add_011.phpt b/ext/opcache/tests/jit/add_011.phpt index 17bd7be99d15..898759b0a894 100644 --- a/ext/opcache/tests/jit/add_011.phpt +++ b/ext/opcache/tests/jit/add_011.phpt @@ -197,4 +197,3 @@ Warning: Undefined variable $u in %sadd_011.php on line 5 Warning: The float %f is not representable as an int, cast occurred in %sadd_011.php on line 5 int(66572500992) - diff --git a/ext/opcache/tests/jit/add_012.phpt b/ext/opcache/tests/jit/add_012.phpt index 707b795f5e03..87ae095f38f1 100644 --- a/ext/opcache/tests/jit/add_012.phpt +++ b/ext/opcache/tests/jit/add_012.phpt @@ -15,4 +15,4 @@ $y[$x] += 4467793343; ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/add_013.phpt b/ext/opcache/tests/jit/add_013.phpt index 9bac9ad51036..ef28c70da26b 100644 --- a/ext/opcache/tests/jit/add_013.phpt +++ b/ext/opcache/tests/jit/add_013.phpt @@ -16,4 +16,4 @@ function y(){ ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/add_014.phpt b/ext/opcache/tests/jit/add_014.phpt index 7f4b96229ad4..a620cc9b392d 100644 --- a/ext/opcache/tests/jit/add_014.phpt +++ b/ext/opcache/tests/jit/add_014.phpt @@ -17,8 +17,8 @@ function test() { try { @test(); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Bit shift by negative number +ArithmeticError: Bit shift by negative number diff --git a/ext/opcache/tests/jit/add_015.phpt b/ext/opcache/tests/jit/add_015.phpt index 6fcded2fe1f5..8322cf1213c7 100644 --- a/ext/opcache/tests/jit/add_015.phpt +++ b/ext/opcache/tests/jit/add_015.phpt @@ -19,4 +19,4 @@ function test() { ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/assign_018.phpt b/ext/opcache/tests/jit/assign_018.phpt index a0c29320ab18..b5ba2a4989e9 100644 --- a/ext/opcache/tests/jit/assign_018.phpt +++ b/ext/opcache/tests/jit/assign_018.phpt @@ -23,4 +23,3 @@ foo(); int(2) array(0) { } - diff --git a/ext/opcache/tests/jit/assign_040.phpt b/ext/opcache/tests/jit/assign_040.phpt index 73eecfe2e109..17e0ef41acaf 100644 --- a/ext/opcache/tests/jit/assign_040.phpt +++ b/ext/opcache/tests/jit/assign_040.phpt @@ -18,10 +18,10 @@ function test() { } try { test(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $y in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string diff --git a/ext/opcache/tests/jit/assign_041.phpt b/ext/opcache/tests/jit/assign_041.phpt index e7e2914875a8..7e4ffeee4db0 100644 --- a/ext/opcache/tests/jit/assign_041.phpt +++ b/ext/opcache/tests/jit/assign_041.phpt @@ -18,4 +18,4 @@ function test($val) { test(0); ?> --EXPECT-- -string(1) "0" \ No newline at end of file +string(1) "0" diff --git a/ext/opcache/tests/jit/assign_043.phpt b/ext/opcache/tests/jit/assign_043.phpt index edb0cb212ab0..666deb35a96e 100644 --- a/ext/opcache/tests/jit/assign_043.phpt +++ b/ext/opcache/tests/jit/assign_043.phpt @@ -13,9 +13,9 @@ set_error_handler(function($_, $m) { try { $a = $b; NOT_REACHED; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined variable $b +Exception: Undefined variable $b diff --git a/ext/opcache/tests/jit/assign_044.phpt b/ext/opcache/tests/jit/assign_044.phpt index e30483d2caec..312aaa3ab9c1 100644 --- a/ext/opcache/tests/jit/assign_044.phpt +++ b/ext/opcache/tests/jit/assign_044.phpt @@ -17,4 +17,3 @@ test(false); ?> --EXPECT-- float(INF) - diff --git a/ext/opcache/tests/jit/assign_045.phpt b/ext/opcache/tests/jit/assign_045.phpt index 8c8f6fc99091..2f15ec62595e 100644 --- a/ext/opcache/tests/jit/assign_045.phpt +++ b/ext/opcache/tests/jit/assign_045.phpt @@ -15,4 +15,3 @@ test(null, 1); ?> --EXPECT-- int(1) - diff --git a/ext/opcache/tests/jit/assign_047.phpt b/ext/opcache/tests/jit/assign_047.phpt index dcd222a8190e..83092e4bb876 100644 --- a/ext/opcache/tests/jit/assign_047.phpt +++ b/ext/opcache/tests/jit/assign_047.phpt @@ -21,4 +21,3 @@ DONE --EXPECTF-- Warning: Undefined variable $a in %sassign_047.php on line 5 DONE - diff --git a/ext/opcache/tests/jit/assign_053.phpt b/ext/opcache/tests/jit/assign_053.phpt index 7e226ab99351..66f2fc79fa0c 100644 --- a/ext/opcache/tests/jit/assign_053.phpt +++ b/ext/opcache/tests/jit/assign_053.phpt @@ -22,4 +22,4 @@ Warning: Undefined variable $y in %sassign_053.php on line 7 Fatal error: Uncaught TypeError: Cannot assign null to reference held by property Test::$x of type string in %sassign_053.php:7 Stack trace: #0 {main} - thrown in %sassign_053.php on line 7 \ No newline at end of file + thrown in %sassign_053.php on line 7 diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt index dac9393d5ba9..53603b5115bb 100644 --- a/ext/opcache/tests/jit/assign_dim_002.phpt +++ b/ext/opcache/tests/jit/assign_dim_002.phpt @@ -30,8 +30,8 @@ function foo3() { $array = array(PHP_INT_MAX => "dummy"); try { $array[] = array(); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $array = new ArrayObject(); @@ -59,8 +59,8 @@ function foo4() { try { $array[function() {}] = 2; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($array); @@ -73,8 +73,8 @@ function foo5() { $a = 1; try { $a[2] = 1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } return $a; } @@ -108,15 +108,15 @@ var_dump(false_to_array(false)); var_dump(false_to_array_append(false)); try { var_dump(false_to_array_invalid_index(false)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(false_to_array_nested(false)); var_dump(false_to_array_nested_append(false)); try { var_dump(false_to_array_nested_invalid_index(false)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function array_access_undef() { @@ -141,7 +141,7 @@ array(1) { array(0) { } } -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 object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(2) { @@ -160,7 +160,7 @@ array(1) { int(1) } } -Cannot access offset of type Closure on array +TypeError: Cannot access offset of type Closure on array array(1) { [0]=> array(2) { @@ -179,7 +179,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -197,7 +197,7 @@ array(1) { } Deprecated: Automatic conversion of false to array is deprecated in %s on line %d -Cannot access offset of type array on array +TypeError: Cannot access offset of type array on array Deprecated: Automatic conversion of false to array is deprecated in %s on line %d int(1) @@ -220,7 +220,7 @@ array(1) { } Deprecated: Automatic conversion of false to array is deprecated in %s on line %d -Cannot access offset of type array on array +TypeError: Cannot access offset of type array on array Warning: Undefined variable $undef in %s on line %d NULL diff --git a/ext/opcache/tests/jit/assign_dim_003.phpt b/ext/opcache/tests/jit/assign_dim_003.phpt index 95fed0b52cce..6d62754cf360 100644 --- a/ext/opcache/tests/jit/assign_dim_003.phpt +++ b/ext/opcache/tests/jit/assign_dim_003.phpt @@ -16,4 +16,4 @@ test(); ?> --EXPECTF-- Warning: Undefined variable $v in %sassign_dim_003.php on line 3 -NULL \ No newline at end of file +NULL diff --git a/ext/opcache/tests/jit/assign_dim_011.phpt b/ext/opcache/tests/jit/assign_dim_011.phpt index 5df415c89e6c..5fa763fe9aa7 100644 --- a/ext/opcache/tests/jit/assign_dim_011.phpt +++ b/ext/opcache/tests/jit/assign_dim_011.phpt @@ -14,11 +14,11 @@ set_error_handler(function($code, $msg) use(&$my_var) { try { $my_var[] = ""; } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> DONE --EXPECT-- Err: Automatic conversion of false to array is deprecated -Exception: Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array DONE diff --git a/ext/opcache/tests/jit/assign_dim_013.phpt b/ext/opcache/tests/jit/assign_dim_013.phpt index cccf0a32150c..582129ede261 100644 --- a/ext/opcache/tests/jit/assign_dim_013.phpt +++ b/ext/opcache/tests/jit/assign_dim_013.phpt @@ -22,4 +22,4 @@ Fatal error: Uncaught Error: Undefined constant "y" in %sassign_dim_013.php:8 Stack trace: #0 %sassign_dim_013.php(11): test() #1 {main} - thrown in %sassign_dim_013.php on line 8 \ No newline at end of file + thrown in %sassign_dim_013.php on line 8 diff --git a/ext/opcache/tests/jit/assign_dim_017.phpt b/ext/opcache/tests/jit/assign_dim_017.phpt index 9b0925f867f8..c3524fdc79b4 100644 --- a/ext/opcache/tests/jit/assign_dim_017.phpt +++ b/ext/opcache/tests/jit/assign_dim_017.phpt @@ -16,4 +16,4 @@ function test() { ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/assign_dim_op_001.phpt b/ext/opcache/tests/jit/assign_dim_op_001.phpt index c5b057e92603..2834ee7ed297 100644 --- a/ext/opcache/tests/jit/assign_dim_op_001.phpt +++ b/ext/opcache/tests/jit/assign_dim_op_001.phpt @@ -48,20 +48,20 @@ false_to_array(false); false_to_array_append(false); try { var_dump(false_to_array_invalid_index(false)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(false_to_array_nested(false)); var_dump(false_to_array_nested_append(false)); try { var_dump(false_to_array_nested_invalid_index(false)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(modulo_string([])); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -78,7 +78,7 @@ Warning: Undefined array key 2 in %s on line %d Deprecated: Automatic conversion of false to array is deprecated in %s on line %d Deprecated: Automatic conversion of false to array is deprecated in %s on line %d -Cannot access offset of type array on array +TypeError: Cannot access offset of type array on array Deprecated: Automatic conversion of false to array is deprecated in %s on line %d @@ -103,5 +103,5 @@ array(1) { } Deprecated: Automatic conversion of false to array is deprecated in %s on line %d -Cannot access offset of type array on array -Unsupported operand types: null % string +TypeError: Cannot access offset of type array on array +TypeError: Unsupported operand types: null % string diff --git a/ext/opcache/tests/jit/assign_dim_op_005.phpt b/ext/opcache/tests/jit/assign_dim_op_005.phpt index a25cc7505e2b..7f61f2251707 100644 --- a/ext/opcache/tests/jit/assign_dim_op_005.phpt +++ b/ext/opcache/tests/jit/assign_dim_op_005.phpt @@ -17,15 +17,15 @@ function test2() { } try { test1(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined variable $undef -Undefined variable $a +Exception: Undefined variable $undef +Exception: Undefined variable $a diff --git a/ext/opcache/tests/jit/assign_dim_undef_exception.phpt b/ext/opcache/tests/jit/assign_dim_undef_exception.phpt index 2c1d0274a1f8..0a87e9f2467c 100644 --- a/ext/opcache/tests/jit/assign_dim_undef_exception.phpt +++ b/ext/opcache/tests/jit/assign_dim_undef_exception.phpt @@ -23,15 +23,15 @@ function test3() { } try { test1(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined variable $undef -Undefined variable $undef +Exception: Undefined variable $undef +Exception: Undefined variable $undef diff --git a/ext/opcache/tests/jit/assign_obj_001.phpt b/ext/opcache/tests/jit/assign_obj_001.phpt index c83a7e649e5b..94c2897a62e5 100644 --- a/ext/opcache/tests/jit/assign_obj_001.phpt +++ b/ext/opcache/tests/jit/assign_obj_001.phpt @@ -17,17 +17,17 @@ function test2($o) { try { test1(null); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(null); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attempt to assign property "x" on null -Attempt to assign property "x" on null +Error: Attempt to assign property "x" on null +Error: Attempt to assign property "x" on null diff --git a/ext/opcache/tests/jit/assign_obj_002.phpt b/ext/opcache/tests/jit/assign_obj_002.phpt index 2b211f79d5dd..f91e9f5c11f7 100644 --- a/ext/opcache/tests/jit/assign_obj_002.phpt +++ b/ext/opcache/tests/jit/assign_obj_002.phpt @@ -23,8 +23,8 @@ function test2() { test(); try { test2(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -32,4 +32,4 @@ Warning: Undefined variable $undef in %s on line %d NULL Warning: Undefined variable $undef in %s on line %d -Cannot assign null to property Test::$prop2 of type int +TypeError: Cannot assign null to property Test::$prop2 of type int diff --git a/ext/opcache/tests/jit/assign_obj_003.phpt b/ext/opcache/tests/jit/assign_obj_003.phpt index 4d878d648efb..7addb1101136 100644 --- a/ext/opcache/tests/jit/assign_obj_003.phpt +++ b/ext/opcache/tests/jit/assign_obj_003.phpt @@ -29,8 +29,8 @@ function xxx() { try { @xxx(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Attempt to assign property "next" on null +Error: Attempt to assign property "next" on null diff --git a/ext/opcache/tests/jit/assign_obj_on_null.phpt b/ext/opcache/tests/jit/assign_obj_on_null.phpt index 3ba85f20a230..136c438c1ea9 100644 --- a/ext/opcache/tests/jit/assign_obj_on_null.phpt +++ b/ext/opcache/tests/jit/assign_obj_on_null.phpt @@ -22,15 +22,15 @@ function test2() { } try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attempt to assign property "y" on null -Attempt to assign property "y" on null +Error: Attempt to assign property "y" on null +Error: Attempt to assign property "y" on null diff --git a/ext/opcache/tests/jit/assign_op_001.phpt b/ext/opcache/tests/jit/assign_op_001.phpt index 957de4d83c56..5ebbcd35a813 100644 --- a/ext/opcache/tests/jit/assign_op_001.phpt +++ b/ext/opcache/tests/jit/assign_op_001.phpt @@ -14,15 +14,15 @@ function test2($a) { } try { test1(1); -} catch (DivisionByZeroError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(1); -} catch (ArithmeticError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Modulo by zero -Bit shift by negative number +DivisionByZeroError: Modulo by zero +ArithmeticError: Bit shift by negative number diff --git a/ext/opcache/tests/jit/assign_op_002.phpt b/ext/opcache/tests/jit/assign_op_002.phpt index fb8b0e46b7f4..067d5f195c8c 100644 --- a/ext/opcache/tests/jit/assign_op_002.phpt +++ b/ext/opcache/tests/jit/assign_op_002.phpt @@ -17,4 +17,4 @@ function test() { test(); ?> --EXPECT-- -string(1) "0" \ No newline at end of file +string(1) "0" diff --git a/ext/opcache/tests/jit/bind_static.phpt b/ext/opcache/tests/jit/bind_static.phpt index 3aaef1befb5e..367c38e8c5d5 100644 --- a/ext/opcache/tests/jit/bind_static.phpt +++ b/ext/opcache/tests/jit/bind_static.phpt @@ -12,10 +12,10 @@ function test() { } try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "UNDEFINED" +Error: Undefined constant "UNDEFINED" diff --git a/ext/opcache/tests/jit/bug80745.phpt b/ext/opcache/tests/jit/bug80745.phpt index f2dec43d2153..c0be5bebe845 100644 --- a/ext/opcache/tests/jit/bug80745.phpt +++ b/ext/opcache/tests/jit/bug80745.phpt @@ -39,4 +39,3 @@ echo "PROBLEM NOT REPRODUCED !\n"; Starting... int(0) PROBLEM NOT REPRODUCED ! - diff --git a/ext/opcache/tests/jit/bug81409.phpt b/ext/opcache/tests/jit/bug81409.phpt index d9501b18ddbb..c617fd648a78 100644 --- a/ext/opcache/tests/jit/bug81409.phpt +++ b/ext/opcache/tests/jit/bug81409.phpt @@ -22,4 +22,4 @@ function bar() { bar(); ?> --EXPECT-- -int(200) \ No newline at end of file +int(200) diff --git a/ext/opcache/tests/jit/bw_not_001.phpt b/ext/opcache/tests/jit/bw_not_001.phpt index 125cc8a1f158..33a37ff0c7f7 100644 --- a/ext/opcache/tests/jit/bw_not_001.phpt +++ b/ext/opcache/tests/jit/bw_not_001.phpt @@ -16,4 +16,4 @@ Warning: Undefined variable $x in %sbw_not_001.php on line 2 Warning: Undefined variable $x in %sbw_not_001.php on line 2 Warning: Undefined array key "" in %sbw_not_001.php on line 2 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/copy_tmp_002.phpt b/ext/opcache/tests/jit/copy_tmp_002.phpt index 01b87b418748..ed61b52ac87c 100644 --- a/ext/opcache/tests/jit/copy_tmp_002.phpt +++ b/ext/opcache/tests/jit/copy_tmp_002.phpt @@ -11,4 +11,4 @@ $x[~"abc"] ??= 0; ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/count_001.phpt b/ext/opcache/tests/jit/count_001.phpt index 2fb1c52d2855..6fca44ecfc21 100644 --- a/ext/opcache/tests/jit/count_001.phpt +++ b/ext/opcache/tests/jit/count_001.phpt @@ -65,4 +65,4 @@ Caught In destructor Caught In destructor Caught In destructor Caught In destructor -Caught In destructor \ No newline at end of file +Caught In destructor diff --git a/ext/opcache/tests/jit/fe_reset_001.phpt b/ext/opcache/tests/jit/fe_reset_001.phpt index fcd1d18ada80..95b7c38661b9 100644 --- a/ext/opcache/tests/jit/fe_reset_001.phpt +++ b/ext/opcache/tests/jit/fe_reset_001.phpt @@ -33,4 +33,3 @@ Warning: Undefined variable $4 in %sfe_reset_001.php on line 4 Warning: foreach() argument must be of type array|object, null given in %sfe_reset_001.php on line 4 OK - diff --git a/ext/opcache/tests/jit/fetch_dim_r_003.phpt b/ext/opcache/tests/jit/fetch_dim_r_003.phpt index 43c216026b93..44157598a10b 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_003.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_003.phpt @@ -21,15 +21,15 @@ function foo() { var_dump($a[null]); try { var_dump($a["ab"]); - } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = "a"; $y = "b"; try { var_dump($a[$x . $y]); - } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a["2x"]); $x = "2"; @@ -55,8 +55,8 @@ string(1) "B" Warning: String offset cast occurred in %s on line %d string(1) "A" -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 Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 24 string(1) "C" diff --git a/ext/opcache/tests/jit/fetch_dim_r_004.phpt b/ext/opcache/tests/jit/fetch_dim_r_004.phpt index d0a25de7936e..5ecfe1f46967 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_004.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_004.phpt @@ -13,8 +13,8 @@ function foo($n) { $a = "ABCDEF"; try { var_dump($a[$n]); - } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } foo(0); @@ -51,8 +51,8 @@ string(1) "B" Warning: String offset cast occurred in %s on line %d string(1) "A" -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 Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5 string(1) "C" diff --git a/ext/opcache/tests/jit/fetch_dim_r_006.phpt b/ext/opcache/tests/jit/fetch_dim_r_006.phpt index 18250aa822ff..10b33b424180 100644 --- a/ext/opcache/tests/jit/fetch_dim_r_006.phpt +++ b/ext/opcache/tests/jit/fetch_dim_r_006.phpt @@ -24,4 +24,4 @@ NULL Warning: Undefined array key 0 in %sfetch_dim_r_006.php on line 5 NULL -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/fetch_obj_001.phpt b/ext/opcache/tests/jit/fetch_obj_001.phpt index ddc8dfafba64..a172f3cfba44 100644 --- a/ext/opcache/tests/jit/fetch_obj_001.phpt +++ b/ext/opcache/tests/jit/fetch_obj_001.phpt @@ -50,24 +50,24 @@ function bar() { $d = array(); try { foo($d->{"ab" ."c"}); - } catch (Error $err) { - echo $err->getMessage(), "\n"; + } catch (Throwable $err) { + echo $err::class, ': ', $err->getMessage(), "\n"; } var_dump($d); $e = NULL; try { foo($e->{"ab" ."c"}); - } catch (Error $err) { - echo $err->getMessage(), "\n"; + } catch (Throwable $err) { + echo $err::class, ': ', $err->getMessage(), "\n"; } var_dump($e); $f = ""; try { foo($f->{"ab" ."c"}); - } catch (Error $err) { - echo $err->getMessage(), "\n"; + } catch (Throwable $err) { + echo $err::class, ': ', $err->getMessage(), "\n"; } var_dump($f); } @@ -127,10 +127,10 @@ object(stdClass)#%d (2) { array(0) { } } -Attempt to modify property "abc" on array +Error: Attempt to modify property "abc" on array array(0) { } -Attempt to modify property "abc" on null +Error: Attempt to modify property "abc" on null NULL -Attempt to modify property "abc" on string +Error: Attempt to modify property "abc" on string string(0) "" diff --git a/ext/opcache/tests/jit/fetch_obj_005.phpt b/ext/opcache/tests/jit/fetch_obj_005.phpt index 2084269bf430..bfd61eb725b2 100644 --- a/ext/opcache/tests/jit/fetch_obj_005.phpt +++ b/ext/opcache/tests/jit/fetch_obj_005.phpt @@ -19,4 +19,4 @@ Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4 Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4 -Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4 \ No newline at end of file +Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4 diff --git a/ext/opcache/tests/jit/gh12509.phpt b/ext/opcache/tests/jit/gh12509.phpt index ae8bdee66196..e96a22f4d0fc 100644 --- a/ext/opcache/tests/jit/gh12509.phpt +++ b/ext/opcache/tests/jit/gh12509.phpt @@ -25,4 +25,4 @@ array(3) { int(2) [3]=> int(3) -} \ No newline at end of file +} diff --git a/ext/opcache/tests/jit/gh12723-A.phpt b/ext/opcache/tests/jit/gh12723-A.phpt index f30453e8c0a3..d0350dca3ae2 100644 --- a/ext/opcache/tests/jit/gh12723-A.phpt +++ b/ext/opcache/tests/jit/gh12723-A.phpt @@ -12,9 +12,9 @@ $dimension = []; try { var_dump($container[$dimension]); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access offset of type array on string +TypeError: Cannot access offset of type array on string diff --git a/ext/opcache/tests/jit/gh12723-B.phpt b/ext/opcache/tests/jit/gh12723-B.phpt index 9f5ae7a19ff1..7018e24b156d 100644 --- a/ext/opcache/tests/jit/gh12723-B.phpt +++ b/ext/opcache/tests/jit/gh12723-B.phpt @@ -11,9 +11,9 @@ $container = new stdClass(); try { $container[new stdClass()] .= 'append'; } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot use object of type stdClass as array +Error: Cannot use object of type stdClass as array diff --git a/ext/opcache/tests/jit/gh12747.phpt b/ext/opcache/tests/jit/gh12747.phpt index df0b039cebc0..1229b7829145 100644 --- a/ext/opcache/tests/jit/gh12747.phpt +++ b/ext/opcache/tests/jit/gh12747.phpt @@ -11,25 +11,25 @@ try { echo "isset():\n"; var_dump(isset($container[new stdClass()])); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo "empty():\n"; var_dump(empty($container[new stdClass()])); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo "Coalesce():\n"; var_dump($container[new stdClass()] ?? 'default'); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- isset(): -Cannot access offset of type stdClass in isset or empty +TypeError: Cannot access offset of type stdClass in isset or empty empty(): -Cannot access offset of type stdClass in isset or empty +TypeError: Cannot access offset of type stdClass in isset or empty Coalesce(): -Cannot access offset of type stdClass on array +TypeError: Cannot access offset of type stdClass on array diff --git a/ext/opcache/tests/jit/gh12748.phpt b/ext/opcache/tests/jit/gh12748.phpt index d7580fdb9ab7..3b309e25745b 100644 --- a/ext/opcache/tests/jit/gh12748.phpt +++ b/ext/opcache/tests/jit/gh12748.phpt @@ -11,19 +11,19 @@ try { echo "isset():\n"; var_dump(isset($container[new stdClass()])); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo "empty():\n"; var_dump(empty($container[new stdClass()])); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo "Coalesce():\n"; var_dump($container[new stdClass()] ?? 'default'); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -32,4 +32,4 @@ bool(false) empty(): bool(true) Coalesce(): -Cannot access offset of type stdClass on string +TypeError: Cannot access offset of type stdClass on string diff --git a/ext/opcache/tests/jit/gh12812.phpt b/ext/opcache/tests/jit/gh12812.phpt index 267abf2aae06..faa6433ce263 100644 --- a/ext/opcache/tests/jit/gh12812.phpt +++ b/ext/opcache/tests/jit/gh12812.phpt @@ -12,12 +12,12 @@ $dimension = '7'; try { var_dump($container['7']); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($container[$dimension]); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/ext/opcache/tests/jit/gh13772.phpt b/ext/opcache/tests/jit/gh13772.phpt index 97fa6536e0ce..172d2e535b7e 100644 --- a/ext/opcache/tests/jit/gh13772.phpt +++ b/ext/opcache/tests/jit/gh13772.phpt @@ -23,4 +23,3 @@ var_dump(Ack(3, 3)); ?> --EXPECT-- int(61) - diff --git a/ext/opcache/tests/jit/gh15652.phpt b/ext/opcache/tests/jit/gh15652.phpt index 2220c7550a66..82762a7138cb 100644 --- a/ext/opcache/tests/jit/gh15652.phpt +++ b/ext/opcache/tests/jit/gh15652.phpt @@ -43,4 +43,4 @@ bool(true) Warning: Undefined property: C2::$value in %sgh15652.php on line 6 Warning: Undefined property: C2::$value in %sgh15652.php on line 6 -bool(true) \ No newline at end of file +bool(true) diff --git a/ext/opcache/tests/jit/gh16499.phpt b/ext/opcache/tests/jit/gh16499.phpt index 6aec1012ab5e..0dad8349a157 100644 --- a/ext/opcache/tests/jit/gh16499.phpt +++ b/ext/opcache/tests/jit/gh16499.phpt @@ -25,4 +25,4 @@ NULL Warning: Undefined variable $i in %sgh16499.php on line 6 Warning: Undefined variable $i in %sgh16499.php on line 6 -NULL \ No newline at end of file +NULL diff --git a/ext/opcache/tests/jit/gh8863.phpt b/ext/opcache/tests/jit/gh8863.phpt index 0d8e833c5faa..dc52e4d73c1f 100644 --- a/ext/opcache/tests/jit/gh8863.phpt +++ b/ext/opcache/tests/jit/gh8863.phpt @@ -22,11 +22,11 @@ class Test { $test = new Test(); try { $test->rw(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> DONE --EXPECT-- -Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop DONE diff --git a/ext/opcache/tests/jit/gh9011.phpt b/ext/opcache/tests/jit/gh9011.phpt index 3ffefe2ce29b..f8667fbae8ce 100644 --- a/ext/opcache/tests/jit/gh9011.phpt +++ b/ext/opcache/tests/jit/gh9011.phpt @@ -24,4 +24,4 @@ foreach ($foo as $baz) { ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/inc_020.phpt b/ext/opcache/tests/jit/inc_020.phpt index 9c0c2472acf4..99610f1d3b4d 100644 --- a/ext/opcache/tests/jit/inc_020.phpt +++ b/ext/opcache/tests/jit/inc_020.phpt @@ -24,4 +24,4 @@ function foo($row) { ?> OK --EXPECT-- -OK \ No newline at end of file +OK diff --git a/ext/opcache/tests/jit/inc_obj_003.phpt b/ext/opcache/tests/jit/inc_obj_003.phpt index dfa556cfe26f..77dd2d42e311 100644 --- a/ext/opcache/tests/jit/inc_obj_003.phpt +++ b/ext/opcache/tests/jit/inc_obj_003.phpt @@ -16,4 +16,4 @@ $v = --$test->prop; var_dump($v); ?> --EXPECT-- -float(0) \ No newline at end of file +float(0) diff --git a/ext/opcache/tests/jit/inc_obj_006.phpt b/ext/opcache/tests/jit/inc_obj_006.phpt index af31d0c471c2..1bdae45fa16e 100644 --- a/ext/opcache/tests/jit/inc_obj_006.phpt +++ b/ext/opcache/tests/jit/inc_obj_006.phpt @@ -27,4 +27,3 @@ Fatal error: Uncaught Error: Attempt to increment/decrement property "y" on int Stack trace: #0 {main} thrown in %sinc_obj_006.php on line 14 - diff --git a/ext/opcache/tests/jit/init_fcall_001.phpt b/ext/opcache/tests/jit/init_fcall_001.phpt index fae4af53179f..19959a235d05 100644 --- a/ext/opcache/tests/jit/init_fcall_001.phpt +++ b/ext/opcache/tests/jit/init_fcall_001.phpt @@ -18,4 +18,3 @@ Stack trace: #0 %sinit_fcall_001.php(5): ini_set() #1 {main} thrown in %sinit_fcall_001.php on line 5 - diff --git a/ext/opcache/tests/jit/isset_002.phpt b/ext/opcache/tests/jit/isset_002.phpt index 2c2527fbe7b9..41f1b6e39a85 100644 --- a/ext/opcache/tests/jit/isset_002.phpt +++ b/ext/opcache/tests/jit/isset_002.phpt @@ -29,4 +29,4 @@ DONE Warning: Undefined variable $how in %sisset_002.php on line 3 Warning: foreach() argument must be of type array|object, null given in %sisset_002.php on line 3 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/match_001.phpt b/ext/opcache/tests/jit/match_001.phpt index b21c5b2c1720..86d9cf9ff514 100644 --- a/ext/opcache/tests/jit/match_001.phpt +++ b/ext/opcache/tests/jit/match_001.phpt @@ -18,4 +18,4 @@ Fatal error: Uncaught UnhandledMatchError: Unhandled match case NULL in %smatch_ Stack trace: #0 %smatch_001.php(5): foo() #1 {main} - thrown in %smatch_001.php on line 3 \ No newline at end of file + thrown in %smatch_001.php on line 3 diff --git a/ext/opcache/tests/jit/mod_001.phpt b/ext/opcache/tests/jit/mod_001.phpt index 03431fe54eb4..c01be5536b6e 100644 --- a/ext/opcache/tests/jit/mod_001.phpt +++ b/ext/opcache/tests/jit/mod_001.phpt @@ -21,12 +21,12 @@ var_dump(mod(-125, -33)); try { var_dump(mod(125, -1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(mod(125, 0)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -37,4 +37,4 @@ int(-29) int(26) int(-26) int(0) -Exception (DivisionByZeroError): Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/opcache/tests/jit/mod_002.phpt b/ext/opcache/tests/jit/mod_002.phpt index b1d163b94d5f..a19d8c41ac38 100644 --- a/ext/opcache/tests/jit/mod_002.phpt +++ b/ext/opcache/tests/jit/mod_002.phpt @@ -33,12 +33,12 @@ var_dump(modNeg33(-125)); try { var_dump(modNeg1(125)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(mod0(125)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -49,4 +49,4 @@ int(-29) int(26) int(-26) int(0) -Exception (DivisionByZeroError): Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/opcache/tests/jit/mod_004.phpt b/ext/opcache/tests/jit/mod_004.phpt index 73cf1a92c47a..b8905ae8c6db 100644 --- a/ext/opcache/tests/jit/mod_004.phpt +++ b/ext/opcache/tests/jit/mod_004.phpt @@ -17,4 +17,4 @@ Warning: Undefined array key "xy" in %smod_004.php on line 4 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in %smod_004.php:4 Stack trace: #0 {main} - thrown in %smod_004.php on line 4 \ No newline at end of file + thrown in %smod_004.php on line 4 diff --git a/ext/opcache/tests/jit/mod_006.phpt b/ext/opcache/tests/jit/mod_006.phpt index 6409cd3253ad..b9abbd8e98ad 100644 --- a/ext/opcache/tests/jit/mod_006.phpt +++ b/ext/opcache/tests/jit/mod_006.phpt @@ -15,4 +15,4 @@ function foo(){ ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/mod_007.phpt b/ext/opcache/tests/jit/mod_007.phpt index 1d76d34fe436..add360e9f3a7 100644 --- a/ext/opcache/tests/jit/mod_007.phpt +++ b/ext/opcache/tests/jit/mod_007.phpt @@ -19,4 +19,4 @@ Fatal error: Uncaught DivisionByZeroError: Modulo by zero in %smod_007.php:4 Stack trace: #0 %smod_007.php(7): test(NULL) #1 {main} - thrown in %smod_007.php on line 4 \ No newline at end of file + thrown in %smod_007.php on line 4 diff --git a/ext/opcache/tests/jit/mul_003.phpt b/ext/opcache/tests/jit/mul_003.phpt index d57534d9b3fc..08f0b4cdd760 100644 --- a/ext/opcache/tests/jit/mul_003.phpt +++ b/ext/opcache/tests/jit/mul_003.phpt @@ -29,4 +29,4 @@ mul1_bound(3); ?> --EXPECT-- int(-6442450944) -int(-6442450944) \ No newline at end of file +int(-6442450944) diff --git a/ext/opcache/tests/jit/mul_005.phpt b/ext/opcache/tests/jit/mul_005.phpt index 7476d215f130..9d475bf5e4ea 100644 --- a/ext/opcache/tests/jit/mul_005.phpt +++ b/ext/opcache/tests/jit/mul_005.phpt @@ -16,9 +16,9 @@ function test($a) { try { test('foo'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: string * int +TypeError: Unsupported operand types: string * int diff --git a/ext/opcache/tests/jit/mul_006.phpt b/ext/opcache/tests/jit/mul_006.phpt index a36bdec41b0e..0dd03fc9dc2a 100644 --- a/ext/opcache/tests/jit/mul_006.phpt +++ b/ext/opcache/tests/jit/mul_006.phpt @@ -15,4 +15,4 @@ for ($i = 0; $i<6; $i++) { ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/mul_007.phpt b/ext/opcache/tests/jit/mul_007.phpt index 71eb4d4009ca..e4a652de183b 100644 --- a/ext/opcache/tests/jit/mul_007.phpt +++ b/ext/opcache/tests/jit/mul_007.phpt @@ -17,4 +17,4 @@ DONE Deprecated: Implicit conversion from float 1.5 to int loses precision in %smul_007.php on line 3 Deprecated: Implicit conversion from float 0.5 to int loses precision in %smul_007.php on line 3 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/mul_009.phpt b/ext/opcache/tests/jit/mul_009.phpt index a6016bd535e7..4f3207d2735e 100644 --- a/ext/opcache/tests/jit/mul_009.phpt +++ b/ext/opcache/tests/jit/mul_009.phpt @@ -16,4 +16,4 @@ Warning: Undefined variable $y in %smul_009.php on line 3 Fatal error: Uncaught TypeError: Unsupported operand types: array * int in %smul_009.php:3 Stack trace: #0 {main} - thrown in %smul_009.php on line 3 \ No newline at end of file + thrown in %smul_009.php on line 3 diff --git a/ext/opcache/tests/jit/mul_010.phpt b/ext/opcache/tests/jit/mul_010.phpt index 6c94f8164487..49422a20ff7f 100644 --- a/ext/opcache/tests/jit/mul_010.phpt +++ b/ext/opcache/tests/jit/mul_010.phpt @@ -25,8 +25,8 @@ function test() { try { @test(); } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: string * float +TypeError: Unsupported operand types: string * float diff --git a/ext/opcache/tests/jit/noval_001.phpt b/ext/opcache/tests/jit/noval_001.phpt index 0fef38652bf4..c09325604940 100644 --- a/ext/opcache/tests/jit/noval_001.phpt +++ b/ext/opcache/tests/jit/noval_001.phpt @@ -31,4 +31,3 @@ var_dump(Foo::bar()); ?> --EXPECT-- string(2) "ok" - diff --git a/ext/opcache/tests/jit/qm_assign_001.phpt b/ext/opcache/tests/jit/qm_assign_001.phpt index ecfda50a28c0..3c89b5360bb4 100644 --- a/ext/opcache/tests/jit/qm_assign_001.phpt +++ b/ext/opcache/tests/jit/qm_assign_001.phpt @@ -13,4 +13,3 @@ Deprecated: Implicit conversion from float 1.5 to int loses precision in %sqm_as Deprecated: Implicit conversion from float 1.5 to int loses precision in %sqm_assign_001.php on line 2 -1 - diff --git a/ext/opcache/tests/jit/qm_assign_002.phpt b/ext/opcache/tests/jit/qm_assign_002.phpt index 8f6328d81dde..2a12942dc44f 100644 --- a/ext/opcache/tests/jit/qm_assign_002.phpt +++ b/ext/opcache/tests/jit/qm_assign_002.phpt @@ -25,4 +25,4 @@ Warning: Undefined variable $b in %sqm_assign_002.php on line 5 Warning: Undefined variable $a in %sqm_assign_002.php on line 4 Warning: Array to string conversion in %sqm_assign_002.php on line 5 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/qm_assign_003.phpt b/ext/opcache/tests/jit/qm_assign_003.phpt index cb62c5425c79..c9c8b126cbd8 100644 --- a/ext/opcache/tests/jit/qm_assign_003.phpt +++ b/ext/opcache/tests/jit/qm_assign_003.phpt @@ -22,4 +22,4 @@ function foo() { ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/qm_assign_undef_exception.phpt b/ext/opcache/tests/jit/qm_assign_undef_exception.phpt index 4e93e2ed7e56..4c2c513141f9 100644 --- a/ext/opcache/tests/jit/qm_assign_undef_exception.phpt +++ b/ext/opcache/tests/jit/qm_assign_undef_exception.phpt @@ -13,9 +13,9 @@ function test() { } try { test(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined variable $b +Exception: Undefined variable $b diff --git a/ext/opcache/tests/jit/recursive_wrong_args.phpt b/ext/opcache/tests/jit/recursive_wrong_args.phpt index 84043ca03d5d..d135f53362f8 100644 --- a/ext/opcache/tests/jit/recursive_wrong_args.phpt +++ b/ext/opcache/tests/jit/recursive_wrong_args.phpt @@ -11,9 +11,9 @@ function f($arg) { } try { f(); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Too few arguments to function f(), 0 passed in %s on line %d and exactly 1 expected +ArgumentCountError: Too few arguments to function f(), 0 passed in %s on line %d and exactly 1 expected diff --git a/ext/opcache/tests/jit/recv_002.phpt b/ext/opcache/tests/jit/recv_002.phpt index 30999dc278d1..016935f94cba 100644 --- a/ext/opcache/tests/jit/recv_002.phpt +++ b/ext/opcache/tests/jit/recv_002.phpt @@ -23,4 +23,4 @@ Fatal error: Uncaught ArgumentCountError: Too few arguments to function test(), Stack trace: #0 %s(7): test() #1 {main} - thrown in %s on line 3 \ No newline at end of file + thrown in %s on line 3 diff --git a/ext/opcache/tests/jit/reg_alloc_005.phpt b/ext/opcache/tests/jit/reg_alloc_005.phpt index f46d0f64e745..3d4d15b896e0 100644 --- a/ext/opcache/tests/jit/reg_alloc_005.phpt +++ b/ext/opcache/tests/jit/reg_alloc_005.phpt @@ -18,4 +18,4 @@ test(); ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/reg_alloc_006.phpt b/ext/opcache/tests/jit/reg_alloc_006.phpt index fa7777a12d83..411a614c7782 100644 --- a/ext/opcache/tests/jit/reg_alloc_006.phpt +++ b/ext/opcache/tests/jit/reg_alloc_006.phpt @@ -30,4 +30,4 @@ Warning: Undefined variable $y in %sreg_alloc_006.php on line 5 Warning: Undefined variable $y in %sreg_alloc_006.php on line 5 Warning: Undefined variable $y in %sreg_alloc_006.php on line 5 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/reg_alloc_010.phpt b/ext/opcache/tests/jit/reg_alloc_010.phpt index 4dd92d43dfad..02b685f5879c 100644 --- a/ext/opcache/tests/jit/reg_alloc_010.phpt +++ b/ext/opcache/tests/jit/reg_alloc_010.phpt @@ -20,4 +20,4 @@ DONE Warning: Undefined variable $cnt in %sreg_alloc_010.php on line 3 Warning: Undefined variable $cnt in %sreg_alloc_010.php on line 3 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/reg_alloc_011.phpt b/ext/opcache/tests/jit/reg_alloc_011.phpt index 521a827cc1f0..8d61ac2047a1 100644 --- a/ext/opcache/tests/jit/reg_alloc_011.phpt +++ b/ext/opcache/tests/jit/reg_alloc_011.phpt @@ -21,4 +21,4 @@ foo(null); ?> DONE --EXPECTF-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/reg_alloc_012.phpt b/ext/opcache/tests/jit/reg_alloc_012.phpt index b684011fbf16..d9d208203379 100644 --- a/ext/opcache/tests/jit/reg_alloc_012.phpt +++ b/ext/opcache/tests/jit/reg_alloc_012.phpt @@ -18,4 +18,4 @@ for ($i = 0; $i < 3; $i++) { ?> DONE --EXPECTF-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/reg_alloc_013.phpt b/ext/opcache/tests/jit/reg_alloc_013.phpt index 73bd3abb6566..cba21193a84d 100644 --- a/ext/opcache/tests/jit/reg_alloc_013.phpt +++ b/ext/opcache/tests/jit/reg_alloc_013.phpt @@ -15,4 +15,4 @@ foo(); DONE --EXPECTF-- Warning: Undefined variable $j in %sreg_alloc_013.php on line 3 -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/reg_alloc_022.phpt b/ext/opcache/tests/jit/reg_alloc_022.phpt index fc9a0b29dff4..80f720627bcf 100644 --- a/ext/opcache/tests/jit/reg_alloc_022.phpt +++ b/ext/opcache/tests/jit/reg_alloc_022.phpt @@ -22,4 +22,4 @@ test(); ?> DONE --EXPECT-- -DONE \ No newline at end of file +DONE diff --git a/ext/opcache/tests/jit/shift_left_001.phpt b/ext/opcache/tests/jit/shift_left_001.phpt index 5b0cbf927caf..c5f0421e780a 100644 --- a/ext/opcache/tests/jit/shift_left_001.phpt +++ b/ext/opcache/tests/jit/shift_left_001.phpt @@ -19,12 +19,12 @@ var_dump(shl(-1, 2)); try { var_dump(shl(1, 64)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(shl(1, -1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -33,4 +33,4 @@ int(2) int(4) int(-4) int(0) -Exception (ArithmeticError): Bit shift by negative number +ArithmeticError: Bit shift by negative number diff --git a/ext/opcache/tests/jit/shift_left_002.phpt b/ext/opcache/tests/jit/shift_left_002.phpt index 979aaf96b0bd..5bdbf8bd745e 100644 --- a/ext/opcache/tests/jit/shift_left_002.phpt +++ b/ext/opcache/tests/jit/shift_left_002.phpt @@ -31,12 +31,12 @@ var_dump(shl2(-1)); try { var_dump(shl64(1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(shlNEG(1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -45,4 +45,4 @@ int(2) int(4) int(-4) int(0) -Exception (ArithmeticError): Bit shift by negative number +ArithmeticError: Bit shift by negative number diff --git a/ext/opcache/tests/jit/shift_right_001.phpt b/ext/opcache/tests/jit/shift_right_001.phpt index 454e8a120449..c1ddb627b284 100644 --- a/ext/opcache/tests/jit/shift_right_001.phpt +++ b/ext/opcache/tests/jit/shift_right_001.phpt @@ -19,17 +19,17 @@ var_dump(shr(-8, 2)); try { var_dump(shr(1, 64)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(shr(-1, 64)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(shr(1, -1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -39,4 +39,4 @@ int(64) int(-2) int(0) int(-1) -Exception (ArithmeticError): Bit shift by negative number +ArithmeticError: Bit shift by negative number diff --git a/ext/opcache/tests/jit/shift_right_002.phpt b/ext/opcache/tests/jit/shift_right_002.phpt index c7d6d227774c..0dea5171512a 100644 --- a/ext/opcache/tests/jit/shift_right_002.phpt +++ b/ext/opcache/tests/jit/shift_right_002.phpt @@ -31,17 +31,17 @@ var_dump(shr2(-8)); try { var_dump(shr64(1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(shr64(-1)); } catch (Throwable $e) { - echo "Exception " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(shrNEG(1)); } catch (Throwable $e) { - echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -51,4 +51,4 @@ int(64) int(-2) int(0) int(-1) -Exception (ArithmeticError): Bit shift by negative number +ArithmeticError: Bit shift by negative number diff --git a/ext/opcache/tests/jit/type_check_001.phpt b/ext/opcache/tests/jit/type_check_001.phpt index 028d2e8637e2..b498fda998dc 100644 --- a/ext/opcache/tests/jit/type_check_001.phpt +++ b/ext/opcache/tests/jit/type_check_001.phpt @@ -16,8 +16,8 @@ try { if (!is_scalar($a)) { undefined_function('Null'); } -} catch (Exception $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/opcache/tests/jit/undef_to_typed_ref.phpt b/ext/opcache/tests/jit/undef_to_typed_ref.phpt index c1308e249a92..dc6e75797d86 100644 --- a/ext/opcache/tests/jit/undef_to_typed_ref.phpt +++ b/ext/opcache/tests/jit/undef_to_typed_ref.phpt @@ -56,51 +56,51 @@ function test_obj_nores() { try { test_simple_res(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_simple_nores(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_dim_res(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_dim_nores(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_obj_res(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test_obj_nores(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $v in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string Warning: Undefined variable $v in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string Warning: Undefined variable $v in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string Warning: Undefined variable $v in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string Warning: Undefined variable $v in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string Warning: Undefined variable $v in %s on line %d -Cannot assign null to reference held by property Test::$x of type string +TypeError: Cannot assign null to reference held by property Test::$x of type string diff --git a/ext/opcache/tests/jit/verify_return_undef.phpt b/ext/opcache/tests/jit/verify_return_undef.phpt index fb07ee42505d..db46ec2dfff8 100644 --- a/ext/opcache/tests/jit/verify_return_undef.phpt +++ b/ext/opcache/tests/jit/verify_return_undef.phpt @@ -13,11 +13,11 @@ function test(): int { try { test(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $undef in %s on line %d -test(): Return value must be of type int, null returned +TypeError: test(): Return value must be of type int, null returned diff --git a/ext/opcache/tests/match_always_error.phpt b/ext/opcache/tests/match_always_error.phpt index 1be5b21305b4..b1a86548877f 100644 --- a/ext/opcache/tests/match_always_error.phpt +++ b/ext/opcache/tests/match_always_error.phpt @@ -13,9 +13,9 @@ function test() { } try { test(); -} catch (UnhandledMatchError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unhandled match case 0 +UnhandledMatchError: Unhandled match case 0 diff --git a/ext/opcache/tests/method_call_on_literal.phpt b/ext/opcache/tests/method_call_on_literal.phpt index 50b0076c4011..ad61adc47c4f 100644 --- a/ext/opcache/tests/method_call_on_literal.phpt +++ b/ext/opcache/tests/method_call_on_literal.phpt @@ -7,10 +7,10 @@ opcache try { (42)->foo(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to a member function foo() on int +Error: Call to a member function foo() on int diff --git a/ext/opcache/tests/opt/coalesce_002.phpt b/ext/opcache/tests/opt/coalesce_002.phpt index c3a05d22e7a1..e118df2cc625 100644 --- a/ext/opcache/tests/opt/coalesce_002.phpt +++ b/ext/opcache/tests/opt/coalesce_002.phpt @@ -19,4 +19,4 @@ Stack trace: #0 %scoalesce_002.php(3): var_dump() #1 %scoalesce_002.php(5): t() #2 {main} - thrown in %scoalesce_002.php on line 3 \ No newline at end of file + thrown in %scoalesce_002.php on line 3 diff --git a/ext/opcache/tests/opt/gh19792.phpt b/ext/opcache/tests/opt/gh19792.phpt index edd805ca57a1..69987d7590de 100644 --- a/ext/opcache/tests/opt/gh19792.phpt +++ b/ext/opcache/tests/opt/gh19792.phpt @@ -17,11 +17,11 @@ function foo() try { foo(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: a warning in %s on line %d -an exception +Error: an exception diff --git a/ext/opcache/tests/opt/inference_003.phpt b/ext/opcache/tests/opt/inference_003.phpt index 046396f21253..b4e585968253 100644 --- a/ext/opcache/tests/opt/inference_003.phpt +++ b/ext/opcache/tests/opt/inference_003.phpt @@ -17,4 +17,3 @@ Fatal error: Uncaught Error: Interface "I" not found in %sinference_003.php:2 Stack trace: #0 {main} thrown in %sinference_003.php on line 2 - diff --git a/ext/opcache/tests/opt/inference_016.phpt b/ext/opcache/tests/opt/inference_016.phpt index 7d1733934fb6..5b8b8a3334cb 100644 --- a/ext/opcache/tests/opt/inference_016.phpt +++ b/ext/opcache/tests/opt/inference_016.phpt @@ -15,11 +15,11 @@ function test() { try { test(); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- NULL Warning: Decrement on type null has no effect, this will change in the next major version of PHP in %sinference_016.php on line %d -Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/opcache/tests/opt/inference_017.phpt b/ext/opcache/tests/opt/inference_017.phpt index 2c9255e3b2b4..00f26bd682a6 100644 --- a/ext/opcache/tests/opt/inference_017.phpt +++ b/ext/opcache/tests/opt/inference_017.phpt @@ -14,8 +14,8 @@ function test() { try { @test(); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Division by zero +DivisionByZeroError: Division by zero diff --git a/ext/opcache/tests/opt/inference_018.phpt b/ext/opcache/tests/opt/inference_018.phpt index 123cb3b9eb62..f865913d01b4 100644 --- a/ext/opcache/tests/opt/inference_018.phpt +++ b/ext/opcache/tests/opt/inference_018.phpt @@ -16,8 +16,8 @@ function test() { try { @test(); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Division by zero +DivisionByZeroError: Division by zero diff --git a/ext/opcache/tests/opt/tmp_001.phpt b/ext/opcache/tests/opt/tmp_001.phpt index 83b679f5f76f..3b1e67e006ff 100644 --- a/ext/opcache/tests/opt/tmp_001.phpt +++ b/ext/opcache/tests/opt/tmp_001.phpt @@ -15,4 +15,4 @@ Fatal error: Uncaught ArgumentCountError: is_a() expects at least 2 arguments, 1 Stack trace: #0 %stmp_001.php(2): is_a(0) #1 {main} - thrown in %stmp_001.php on line 2 \ No newline at end of file + thrown in %stmp_001.php on line 2 diff --git a/ext/opcache/tests/optimize_static_001.phpt b/ext/opcache/tests/optimize_static_001.phpt index a71f029b3302..894d9f0d8c2e 100644 --- a/ext/opcache/tests/optimize_static_001.phpt +++ b/ext/opcache/tests/optimize_static_001.phpt @@ -14,10 +14,10 @@ function foo() { try { foo(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> OK --EXPECT-- -Exception: Undefined constant "UNDEFINED_CONST" +Error: Undefined constant "UNDEFINED_CONST" OK diff --git a/ext/opcache/tests/preload_004.phpt b/ext/opcache/tests/preload_004.phpt index 76047bde6222..fee4eb682146 100644 --- a/ext/opcache/tests/preload_004.phpt +++ b/ext/opcache/tests/preload_004.phpt @@ -17,9 +17,9 @@ var_dump(class_exists('Foo')); try { new Foo(); } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -Undefined constant self::DOES_NOT_EXIST +Error: Undefined constant self::DOES_NOT_EXIST diff --git a/ext/opcache/tests/preload_009.phpt b/ext/opcache/tests/preload_009.phpt index bb15998f7ab0..71702922bea3 100644 --- a/ext/opcache/tests/preload_009.phpt +++ b/ext/opcache/tests/preload_009.phpt @@ -18,10 +18,10 @@ var_dump(class_exists('Foo')); try { new Foo(); } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- bool(true) bool(true) -Undefined constant "UNDEF" +Error: Undefined constant "UNDEF" diff --git a/ext/opcache/tests/preload_012.phpt b/ext/opcache/tests/preload_012.phpt index 836d4707a0d9..b23876666cbe 100644 --- a/ext/opcache/tests/preload_012.phpt +++ b/ext/opcache/tests/preload_012.phpt @@ -19,9 +19,9 @@ var_dump(class_exists('Test')); try { new Test(); } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -Undefined constant Foo::BAR +Error: Undefined constant Foo::BAR diff --git a/ext/opcache/tests/ssa_bug_003.phpt b/ext/opcache/tests/ssa_bug_003.phpt index 780a02955786..95de8b40290b 100644 --- a/ext/opcache/tests/ssa_bug_003.phpt +++ b/ext/opcache/tests/ssa_bug_003.phpt @@ -18,8 +18,8 @@ function test1($x) : callable { try { test1(1); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Foo {} @@ -30,11 +30,11 @@ function test2() : Foo { try { test2(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -test1(): Return value must be of type callable, string returned -test2(): Return value must be of type Foo, stdClass returned +TypeError: test1(): Return value must be of type callable, string returned +TypeError: test2(): Return value must be of type Foo, stdClass returned From 7a8131e09ce2929b52fea54901661daf7f6b76a2 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 22 Aug 2026 13:54:52 +0100 Subject: [PATCH 05/27] Revert "Fix GH-22142: Assertion failure in zendi_try_get_long() on IS_UNDEF." This reverts commit 9e1b285f65a5df3fa5366e6c8241152a4ceb88d4. --- Zend/zend_operators.c | 1 - ext/zlib/tests/gh22142.phpt | 21 --------------------- 2 files changed, 22 deletions(-) delete mode 100644 ext/zlib/tests/gh22142.phpt diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index ab8f2c2b54f8..b1b1a39a536a 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -448,7 +448,6 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval * ZEND_ASSERT(Z_TYPE(dst) == IS_LONG); return Z_LVAL(dst); } - case IS_UNDEF: case IS_RESOURCE: case IS_ARRAY: *failed = true; diff --git a/ext/zlib/tests/gh22142.phpt b/ext/zlib/tests/gh22142.phpt deleted file mode 100644 index 481ffef342aa..000000000000 --- a/ext/zlib/tests/gh22142.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -GH-22142 (Assertion failure in zendi_try_get_long() on IS_UNDEF) ---EXTENSIONS-- -zlib ---FILE-- -getMessage(), PHP_EOL; -} - -?> ---EXPECTF-- -Deprecated: deflate_init(): Passing an object for argument #2 $option to deflate_init() is deprecated, call get_object_vars() first instead in %s on line %d -TypeError: deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given From ed1fe415b74dbd6d1a80540a9e82d90b4740e7df Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:02:14 +0700 Subject: [PATCH 06/27] ext/xmlwriter: applied fixers to improve test robustness (#23026) --- ext/xmlwriter/tests/010.phpt | 12 ++++++------ .../tests/xmlwriter_open_uri_error_001.phpt | 6 +++--- .../xmlwriter_toMemory_custom_constructor_error.phpt | 4 ++-- .../xmlwriter_toStream_custom_constructor_error.phpt | 4 ++-- .../xmlwriter_toStream_open_invalidated_stream.phpt | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ext/xmlwriter/tests/010.phpt b/ext/xmlwriter/tests/010.phpt index 29d7d6fa7cee..3d7d310d5fe0 100644 --- a/ext/xmlwriter/tests/010.phpt +++ b/ext/xmlwriter/tests/010.phpt @@ -15,16 +15,16 @@ var_dump(xmlwriter_end_attribute($xw)); try { xmlwriter_start_attribute($xw, "-1"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(xmlwriter_end_attribute($xw)); try { xmlwriter_start_attribute($xw, "\""); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(xmlwriter_end_attribute($xw)); @@ -45,9 +45,9 @@ echo "Done\n"; bool(true) bool(true) bool(true) -xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, "-1" given +ValueError: xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, "-1" given bool(false) -xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, """ given +ValueError: xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, """ given bool(false) bool(true) string(14) "" diff --git a/ext/xmlwriter/tests/xmlwriter_open_uri_error_001.phpt b/ext/xmlwriter/tests/xmlwriter_open_uri_error_001.phpt index 3b136a9be2c8..588c0f7cb2c2 100644 --- a/ext/xmlwriter/tests/xmlwriter_open_uri_error_001.phpt +++ b/ext/xmlwriter/tests/xmlwriter_open_uri_error_001.phpt @@ -6,8 +6,8 @@ xmlwriter getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --CREDITS-- @@ -15,4 +15,4 @@ Koen Kuipers koenk82@gmail.com Theo van der Zee #Test Fest Utrecht 09-05-2009 --EXPECT-- -xmlwriter_open_uri(): Argument #1 ($uri) must not be empty +ValueError: xmlwriter_open_uri(): Argument #1 ($uri) must not be empty diff --git a/ext/xmlwriter/tests/xmlwriter_toMemory_custom_constructor_error.phpt b/ext/xmlwriter/tests/xmlwriter_toMemory_custom_constructor_error.phpt index 3a87d963c9d6..935c4d4b481e 100644 --- a/ext/xmlwriter/tests/xmlwriter_toMemory_custom_constructor_error.phpt +++ b/ext/xmlwriter/tests/xmlwriter_toMemory_custom_constructor_error.phpt @@ -14,9 +14,9 @@ class CustomXMLWriter extends XMLWriter { try { CustomXMLWriter::toMemory(); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -nope +Error: nope diff --git a/ext/xmlwriter/tests/xmlwriter_toStream_custom_constructor_error.phpt b/ext/xmlwriter/tests/xmlwriter_toStream_custom_constructor_error.phpt index 636d8ffbbc01..f3f0b6856354 100644 --- a/ext/xmlwriter/tests/xmlwriter_toStream_custom_constructor_error.phpt +++ b/ext/xmlwriter/tests/xmlwriter_toStream_custom_constructor_error.phpt @@ -16,9 +16,9 @@ $h = fopen("php://output", "w"); try { CustomXMLWriter::toStream($h); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -nope +Error: nope diff --git a/ext/xmlwriter/tests/xmlwriter_toStream_open_invalidated_stream.phpt b/ext/xmlwriter/tests/xmlwriter_toStream_open_invalidated_stream.phpt index b6c6733bb7f8..60736ed1ae09 100644 --- a/ext/xmlwriter/tests/xmlwriter_toStream_open_invalidated_stream.phpt +++ b/ext/xmlwriter/tests/xmlwriter_toStream_open_invalidated_stream.phpt @@ -10,10 +10,10 @@ fclose($h); try { XMLWriter::toStream($h); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -XMLWriter::toStream(): supplied resource is not a valid stream resource +TypeError: XMLWriter::toStream(): supplied resource is not a valid stream resource From d9640d76c4f3ccdd12e62f32d5d7665d880c7321 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:03:08 +0700 Subject: [PATCH 07/27] ext/simplexml: applied fixers to improve test robustness (#23030) --- ext/simplexml/tests/012.phpt | 12 +++--- ..._addAttribute_required_attribute_name.phpt | 6 +-- .../tests/SimpleXMLElement_xpath.phpt | 6 +-- .../tests/SimpleXMLElement_xpath_4.phpt | 6 +-- ext/simplexml/tests/bug37076_1.phpt | 6 +-- ext/simplexml/tests/bug38406.phpt | 6 +-- ext/simplexml/tests/current_error.phpt | 12 +++--- ext/simplexml/tests/gh12929.phpt | 12 +++--- ext/simplexml/tests/key_error.phpt | 12 +++--- .../tests/simplexml_uninitialized.phpt | 42 +++++++++---------- 10 files changed, 60 insertions(+), 60 deletions(-) diff --git a/ext/simplexml/tests/012.phpt b/ext/simplexml/tests/012.phpt index a68345d29d9a..1bb9605745d1 100644 --- a/ext/simplexml/tests/012.phpt +++ b/ext/simplexml/tests/012.phpt @@ -14,8 +14,8 @@ $sxe = simplexml_load_string($xml); try { $sxe[""] = "value"; -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $sxe["attr"] = "value"; @@ -28,17 +28,17 @@ echo $sxe->asXML(); try { $sxe[] = "error"; -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } __HALT_COMPILER(); ?> ===DONE=== --EXPECT-- -Cannot create attribute with an empty name +ValueError: Cannot create attribute with an empty name -Cannot append to an attribute list +ValueError: Cannot append to an attribute list diff --git a/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt b/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt index 65f8f7baa8b7..a3b86af10ac5 100644 --- a/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt @@ -11,13 +11,13 @@ $a = new SimpleXMLElement("testfest"); try { $a->addAttribute( "", "" ); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo $a->asXML(); ?> --EXPECT-- -SimpleXMLElement::addAttribute(): Argument #1 ($qualifiedName) must not be empty +ValueError: SimpleXMLElement::addAttribute(): Argument #1 ($qualifiedName) must not be empty testfest diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt index 8af58ec2a0aa..3eaa4a1fccd1 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt @@ -13,9 +13,9 @@ $xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER) // $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL try { var_dump($xml->xpath("BBBB")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt index b111b0bfb34a..e156a64dc7c2 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt @@ -11,11 +11,11 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); try { simplexml_load_string("XXXXXXX^", $x, 0x6000000000000001); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $x in %s on line %d -simplexml_load_string(): Argument #3 ($options) is too large +ValueError: simplexml_load_string(): Argument #3 ($options) is too large diff --git a/ext/simplexml/tests/bug37076_1.phpt b/ext/simplexml/tests/bug37076_1.phpt index ed7fecd104c2..6b2428ee1c9d 100644 --- a/ext/simplexml/tests/bug37076_1.phpt +++ b/ext/simplexml/tests/bug37076_1.phpt @@ -9,13 +9,13 @@ $xml = simplexml_load_string(""); try { $xml->{""} .= "bar"; -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } print $xml->asXML(); ?> --EXPECT-- -Cannot create element with an empty name +ValueError: Cannot create element with an empty name diff --git a/ext/simplexml/tests/bug38406.phpt b/ext/simplexml/tests/bug38406.phpt index 41f2df7aaf60..f56abe5b0a7c 100644 --- a/ext/simplexml/tests/bug38406.phpt +++ b/ext/simplexml/tests/bug38406.phpt @@ -16,8 +16,8 @@ $a = array(); try { $item->$a = new stdclass; -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; @@ -33,5 +33,5 @@ object(SimpleXMLElement)#%d (1) { } Warning: Array to string conversion in %s on line %d -It's not possible to assign a complex type to properties, stdClass given +TypeError: It's not possible to assign a complex type to properties, stdClass given Done diff --git a/ext/simplexml/tests/current_error.phpt b/ext/simplexml/tests/current_error.phpt index dc22f735477d..b507eb1c6549 100644 --- a/ext/simplexml/tests/current_error.phpt +++ b/ext/simplexml/tests/current_error.phpt @@ -16,8 +16,8 @@ $sxe = simplexml_load_string($xml); try { $sxe->current(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { @@ -26,14 +26,14 @@ for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { try { $sxe->current(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed string(4) "elem" object(SimpleXMLElement)#3 (0) { } -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed diff --git a/ext/simplexml/tests/gh12929.phpt b/ext/simplexml/tests/gh12929.phpt index 2ae89346dba8..f64bf7280699 100644 --- a/ext/simplexml/tests/gh12929.phpt +++ b/ext/simplexml/tests/gh12929.phpt @@ -8,8 +8,8 @@ $scheme = "foo1"; stream_wrapper_register($scheme, "SimpleXMLIterator"); try { file_get_contents($scheme . "://x"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; echo $e->getPrevious()->getMessage(), "\n"; } @@ -17,13 +17,13 @@ $scheme = "foo2"; stream_wrapper_register($scheme, "SimpleXMLElement"); try { file_get_contents($scheme . "://x"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; echo $e->getPrevious()->getMessage(), "\n"; } ?> --EXPECT-- -It's not possible to assign a complex type to properties, resource given +TypeError: It's not possible to assign a complex type to properties, resource given SimpleXMLElement is not properly initialized -It's not possible to assign a complex type to properties, resource given +TypeError: It's not possible to assign a complex type to properties, resource given SimpleXMLElement is not properly initialized diff --git a/ext/simplexml/tests/key_error.phpt b/ext/simplexml/tests/key_error.phpt index 5801aec1040b..e38d8f305c9d 100644 --- a/ext/simplexml/tests/key_error.phpt +++ b/ext/simplexml/tests/key_error.phpt @@ -16,8 +16,8 @@ $sxe = simplexml_load_string($xml); try { $sxe->key(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { @@ -26,14 +26,14 @@ for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { try { $sxe->key(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed string(4) "elem" object(SimpleXMLElement)#3 (0) { } -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed diff --git a/ext/simplexml/tests/simplexml_uninitialized.phpt b/ext/simplexml/tests/simplexml_uninitialized.phpt index ade8b809b7aa..4731f58fd418 100644 --- a/ext/simplexml/tests/simplexml_uninitialized.phpt +++ b/ext/simplexml/tests/simplexml_uninitialized.phpt @@ -14,46 +14,46 @@ class MySXE extends SimpleXMLElement { $sxe = new MySXE; try { var_dump($sxe->count()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->xpath('')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->getDocNamespaces()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->children()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->attributes()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->registerXPathNamespace('', '')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->foo); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized From 2f981224b02d73b5ba8ed7d0e262dcd9c7ab8161 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:03:25 +0700 Subject: [PATCH 08/27] ext/libxml: applied fixers to improve test robustness (#23024) --- ext/libxml/tests/004.phpt | 14 +++++++------- ext/libxml/tests/bug63389.phpt | 12 ++++++------ ...external_entity_loader_error_callback_name.phpt | 4 ++-- .../libxml_set_external_entity_loader_error1.phpt | 4 ++-- .../libxml_set_external_entity_loader_error2.phpt | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ext/libxml/tests/004.phpt b/ext/libxml/tests/004.phpt index 718f8cbdc202..d5ba2bdb4a89 100644 --- a/ext/libxml/tests/004.phpt +++ b/ext/libxml/tests/004.phpt @@ -17,8 +17,8 @@ $ctxs = array( foreach ($ctxs as $ctx) { try { var_dump(libxml_set_streams_context($ctx)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = new DOMDocument(); var_dump($dom->load(__DIR__.'/test.xml')); @@ -28,15 +28,15 @@ echo "Done\n"; ?> --EXPECT-- -libxml_set_streams_context(): Argument #1 ($context) must be of type resource, null given +TypeError: libxml_set_streams_context(): Argument #1 ($context) must be of type resource, null given bool(true) -libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given +TypeError: libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given bool(true) -libxml_set_streams_context(): Argument #1 ($context) must be of type resource, int given +TypeError: libxml_set_streams_context(): Argument #1 ($context) must be of type resource, int given bool(true) -libxml_set_streams_context(): Argument #1 ($context) must be of type resource, stdClass given +TypeError: libxml_set_streams_context(): Argument #1 ($context) must be of type resource, stdClass given bool(true) -libxml_set_streams_context(): Argument #1 ($context) must be of type resource, array given +TypeError: libxml_set_streams_context(): Argument #1 ($context) must be of type resource, array given bool(true) NULL bool(true) diff --git a/ext/libxml/tests/bug63389.phpt b/ext/libxml/tests/bug63389.phpt index 90a209e7be12..422e03267dc1 100644 --- a/ext/libxml/tests/bug63389.phpt +++ b/ext/libxml/tests/bug63389.phpt @@ -6,18 +6,18 @@ libxml getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $fp = fopen("php://input", "r"); try { libxml_set_streams_context($fp); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "okey"; ?> --EXPECT-- -libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given -libxml_set_streams_context(): supplied resource is not a valid Stream-Context resource +TypeError: libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given +TypeError: libxml_set_streams_context(): supplied resource is not a valid Stream-Context resource okey diff --git a/ext/libxml/tests/libxml_get_external_entity_loader_error_callback_name.phpt b/ext/libxml/tests/libxml_get_external_entity_loader_error_callback_name.phpt index 3dca273d5959..d37ada1ab2b3 100644 --- a/ext/libxml/tests/libxml_get_external_entity_loader_error_callback_name.phpt +++ b/ext/libxml/tests/libxml_get_external_entity_loader_error_callback_name.phpt @@ -32,9 +32,9 @@ $r = $dd->loadXML($xml); try { var_dump($dd->validate()); } catch (\Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(122) "DOMDocument::validate(): The user entity loader callback "Handler::handle" has returned a resource, but it is not a stream" +TypeError: DOMDocument::validate(): The user entity loader callback "Handler::handle" has returned a resource, but it is not a stream diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt index 050aa7830680..1bfc64da26ee 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt @@ -16,12 +16,12 @@ var_dump(libxml_set_external_entity_loader(function($a, $b, $c, $d) {})); try { var_dump($dd->validate()); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done.\n"; ?> --EXPECTF-- bool(true) -Exception: Too few arguments to function {closure:%s:%d}(), 3 passed and exactly 4 expected +ArgumentCountError: Too few arguments to function {closure:%s:%d}(), 3 passed and exactly 4 expected Done. diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error2.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error2.phpt index 053551f5ff3e..d8c574e86da8 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_error2.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_error2.phpt @@ -7,8 +7,8 @@ libxml try { libxml_set_external_entity_loader('nonexistent_function'); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, function "nonexistent_function" not found or invalid function name +TypeError: libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, function "nonexistent_function" not found or invalid function name From 3855c7c1431ed6fe44b74b7383135a84add6fe65 Mon Sep 17 00:00:00 2001 From: laokz <26503046+laokz@users.noreply.github.com> Date: Sat, 22 Aug 2026 21:07:18 +0800 Subject: [PATCH 09/27] tests/GHSA-x692-q9x7-8c3f.phpt: Add extensions required (#23408) bccomp() is in bcmath extension. Add the requires to avoid test failure if bcmath extension not configured. Signed-off-by: Kai Zhang --- ext/bcmath/tests/GHSA-x692-q9x7-8c3f.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/bcmath/tests/GHSA-x692-q9x7-8c3f.phpt b/ext/bcmath/tests/GHSA-x692-q9x7-8c3f.phpt index b735958bd07a..d544ad949bbe 100644 --- a/ext/bcmath/tests/GHSA-x692-q9x7-8c3f.phpt +++ b/ext/bcmath/tests/GHSA-x692-q9x7-8c3f.phpt @@ -1,5 +1,7 @@ --TEST-- GHSA-x692-q9x7-8c3f: bccomp() out-of-bounds write +--EXTENSIONS-- +bcmath --CREDITS-- Recep Asan (recepasan) --FILE-- From 7ca205842e164cb12253c760489e5348cf54e397 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:08:15 +0700 Subject: [PATCH 10/27] ext/bcmath: applied fixers to improve test robustness (#23129) --- ext/bcmath/tests/bcadd_error.phpt | 12 ++-- ext/bcmath/tests/bcceil_error.phpt | 8 +-- ext/bcmath/tests/bccomp_error.phpt | 12 ++-- ext/bcmath/tests/bcdiv_error1.phpt | 18 ++--- ext/bcmath/tests/bcdiv_error2.phpt | 12 ++-- ext/bcmath/tests/bcfloor_error.phpt | 8 +-- ext/bcmath/tests/bcmod_error2.phpt | 18 ++--- ext/bcmath/tests/bcmod_error3.phpt | 12 ++-- ext/bcmath/tests/bcmul_error.phpt | 12 ++-- ext/bcmath/tests/bcpow_div_by_zero.phpt | 16 ++--- ext/bcmath/tests/bcpow_error1.phpt | 12 ++-- ext/bcmath/tests/bcpow_error2.phpt | 12 ++-- ext/bcmath/tests/bcpow_error3.phpt | 12 ++-- ext/bcmath/tests/bcpowmod_error.phpt | 18 ++--- .../tests/bcpowmod_negative_exponent.phpt | 6 +- ext/bcmath/tests/bcpowmod_zero_modulus.phpt | 6 +- ext/bcmath/tests/bcround_error.phpt | 8 +-- .../tests/bcround_precision_bounds.phpt | 18 ++--- ext/bcmath/tests/bcscale_variation001.phpt | 8 +-- ext/bcmath/tests/bcsqrt_error1.phpt | 6 +- ext/bcmath/tests/bcsqrt_error2.phpt | 6 +- ext/bcmath/tests/bcsub_error.phpt | 12 ++-- ext/bcmath/tests/bug60377.phpt | 6 +- ext/bcmath/tests/bug72093.phpt | 12 ++-- ext/bcmath/tests/bug75178.phpt | 12 ++-- ext/bcmath/tests/bug78878.phpt | 6 +- ext/bcmath/tests/bug80545.phpt | 12 ++-- ext/bcmath/tests/gh15968.phpt | 6 +- ext/bcmath/tests/negative_scale.phpt | 60 ++++++++--------- ext/bcmath/tests/number/construct_error.phpt | 12 ++-- .../methods/calc_methods_num_arg_error.phpt | 48 +++++++------- .../methods/calc_methods_scale_arg_error.phpt | 28 ++++---- .../number/methods/compare_arg_error.phpt | 10 +-- .../tests/number/methods/pow_div_by_zero.phpt | 16 ++--- .../number/methods/powmod_arg_error.phpt | 24 +++---- .../tests/number/operators/calc_array.phpt | 36 +++++----- .../operators/calc_non_numeric_string.phpt | 36 +++++----- .../tests/number/operators/calc_null.phpt | 36 +++++----- .../number/operators/calc_other_class.phpt | 36 +++++----- .../tests/number/operators/calc_undef.phpt | 36 +++++----- .../tests/number/operators/div_by_zero.phpt | 36 +++++----- .../tests/number/operators/mod_by_zero.phpt | 36 +++++----- .../number/operators/pow_div_by_zero.phpt | 16 ++--- .../tests/number/properties_unknown.phpt | 12 ++-- ext/bcmath/tests/number/properties_unset.phpt | 12 ++-- .../tests/number/properties_write_error.phpt | 12 ++-- .../tests/number/unserialize_error.phpt | 18 ++--- .../tests/sec_embedded_null_truncation.phpt | 52 +++++++-------- ext/bcmath/tests/str2num_formatting.phpt | 66 +++++++++---------- 49 files changed, 472 insertions(+), 472 deletions(-) diff --git a/ext/bcmath/tests/bcadd_error.phpt b/ext/bcmath/tests/bcadd_error.phpt index 320bf390680a..77cb46c18c1f 100644 --- a/ext/bcmath/tests/bcadd_error.phpt +++ b/ext/bcmath/tests/bcadd_error.phpt @@ -7,17 +7,17 @@ bcmath try { bcadd('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcadd('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #2 ($num2) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/bcceil_error.phpt b/ext/bcmath/tests/bcceil_error.phpt index fd4c51ff6c58..58df0fdce601 100644 --- a/ext/bcmath/tests/bcceil_error.phpt +++ b/ext/bcmath/tests/bcceil_error.phpt @@ -7,15 +7,15 @@ bcmath try { bcceil('hoge'); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcceil('0.00.1'); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcceil(): Argument #1 ($num) is not well-formed -bcceil(): Argument #1 ($num) is not well-formed +ValueError: bcceil(): Argument #1 ($num) is not well-formed +ValueError: bcceil(): Argument #1 ($num) is not well-formed diff --git a/ext/bcmath/tests/bccomp_error.phpt b/ext/bcmath/tests/bccomp_error.phpt index 90645c52f7e5..5cc2c2f4ca03 100644 --- a/ext/bcmath/tests/bccomp_error.phpt +++ b/ext/bcmath/tests/bccomp_error.phpt @@ -7,17 +7,17 @@ bcmath try { bccomp('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bccomp('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bccomp(): Argument #1 ($num1) is not well-formed -bccomp(): Argument #2 ($num2) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bccomp(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/bcdiv_error1.phpt b/ext/bcmath/tests/bcdiv_error1.phpt index b6af64d69af3..154f20e52d82 100644 --- a/ext/bcmath/tests/bcdiv_error1.phpt +++ b/ext/bcmath/tests/bcdiv_error1.phpt @@ -10,23 +10,23 @@ bcmath getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { bcdiv('10.99', '0.00'); -} catch (DivisionByZeroError $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { bcdiv('10.99', '-0.00'); -} catch (DivisionByZeroError $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Division by zero -Division by zero -Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero diff --git a/ext/bcmath/tests/bcdiv_error2.phpt b/ext/bcmath/tests/bcdiv_error2.phpt index a4e1cae35354..622760327c5d 100644 --- a/ext/bcmath/tests/bcdiv_error2.phpt +++ b/ext/bcmath/tests/bcdiv_error2.phpt @@ -7,17 +7,17 @@ bcmath try { bcdiv('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcdiv('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcdiv(): Argument #1 ($num1) is not well-formed -bcdiv(): Argument #2 ($num2) is not well-formed +ValueError: bcdiv(): Argument #1 ($num1) is not well-formed +ValueError: bcdiv(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/bcfloor_error.phpt b/ext/bcmath/tests/bcfloor_error.phpt index 7578a5afe3b8..28556b366aaa 100644 --- a/ext/bcmath/tests/bcfloor_error.phpt +++ b/ext/bcmath/tests/bcfloor_error.phpt @@ -7,15 +7,15 @@ bcmath try { bcfloor('hoge'); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcfloor('0.00.1'); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcfloor(): Argument #1 ($num) is not well-formed -bcfloor(): Argument #1 ($num) is not well-formed +ValueError: bcfloor(): Argument #1 ($num) is not well-formed +ValueError: bcfloor(): Argument #1 ($num) is not well-formed diff --git a/ext/bcmath/tests/bcmod_error2.phpt b/ext/bcmath/tests/bcmod_error2.phpt index 37c433fbb89c..f3cb6074cb26 100644 --- a/ext/bcmath/tests/bcmod_error2.phpt +++ b/ext/bcmath/tests/bcmod_error2.phpt @@ -8,21 +8,21 @@ bcmath.scale=0 getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { bcmod("10", "0.000"); -} catch (DivisionByZeroError $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { bcmod("10", "-0.0"); -} catch (DivisionByZeroError $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Modulo by zero -Modulo by zero -Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/bcmath/tests/bcmod_error3.phpt b/ext/bcmath/tests/bcmod_error3.phpt index 8df986fe7654..ee8768f90e79 100644 --- a/ext/bcmath/tests/bcmod_error3.phpt +++ b/ext/bcmath/tests/bcmod_error3.phpt @@ -7,17 +7,17 @@ bcmath try { bcmod('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcmod('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcmod(): Argument #1 ($num1) is not well-formed -bcmod(): Argument #2 ($num2) is not well-formed +ValueError: bcmod(): Argument #1 ($num1) is not well-formed +ValueError: bcmod(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/bcmul_error.phpt b/ext/bcmath/tests/bcmul_error.phpt index 361b46163ee6..b1a6364c6a65 100644 --- a/ext/bcmath/tests/bcmul_error.phpt +++ b/ext/bcmath/tests/bcmul_error.phpt @@ -7,17 +7,17 @@ bcmath try { bcmul('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcmul('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcmul(): Argument #1 ($num1) is not well-formed -bcmul(): Argument #2 ($num2) is not well-formed +ValueError: bcmul(): Argument #1 ($num1) is not well-formed +ValueError: bcmul(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/bcpow_div_by_zero.phpt b/ext/bcmath/tests/bcpow_div_by_zero.phpt index ac1e8187450c..1d6fb2b7d2f4 100644 --- a/ext/bcmath/tests/bcpow_div_by_zero.phpt +++ b/ext/bcmath/tests/bcpow_div_by_zero.phpt @@ -13,17 +13,17 @@ foreach ($baseNumbers as $baseNumber) { foreach ($exponents as $exponent) { try { echo bcpow($baseNumber, $exponent), "\n"; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } ?> --EXPECT-- -Negative power of zero -Negative power of zero -Negative power of zero -Negative power of zero -Negative power of zero -Negative power of zero +DivisionByZeroError: Negative power of zero +DivisionByZeroError: Negative power of zero +DivisionByZeroError: Negative power of zero +DivisionByZeroError: Negative power of zero +DivisionByZeroError: Negative power of zero +DivisionByZeroError: Negative power of zero diff --git a/ext/bcmath/tests/bcpow_error1.phpt b/ext/bcmath/tests/bcpow_error1.phpt index fefdfc57a010..0a78b4bdeb51 100644 --- a/ext/bcmath/tests/bcpow_error1.phpt +++ b/ext/bcmath/tests/bcpow_error1.phpt @@ -6,15 +6,15 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bcpow('1', '0.1', 2)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpow(): Argument #2 ($exponent) cannot have a fractional part -bcpow(): Argument #2 ($exponent) cannot have a fractional part +ValueError: bcpow(): Argument #2 ($exponent) cannot have a fractional part +ValueError: bcpow(): Argument #2 ($exponent) cannot have a fractional part diff --git a/ext/bcmath/tests/bcpow_error2.phpt b/ext/bcmath/tests/bcpow_error2.phpt index f9b830ca7d5b..a959a37399ee 100644 --- a/ext/bcmath/tests/bcpow_error2.phpt +++ b/ext/bcmath/tests/bcpow_error2.phpt @@ -6,16 +6,16 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bcpow('0', '-9223372036854775808', 2)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpow(): Argument #2 ($exponent) is too large -bcpow(): Argument #2 ($exponent) is too large +ValueError: bcpow(): Argument #2 ($exponent) is too large +ValueError: bcpow(): Argument #2 ($exponent) is too large diff --git a/ext/bcmath/tests/bcpow_error3.phpt b/ext/bcmath/tests/bcpow_error3.phpt index f47c85d4da86..1c97cce12b6f 100644 --- a/ext/bcmath/tests/bcpow_error3.phpt +++ b/ext/bcmath/tests/bcpow_error3.phpt @@ -7,17 +7,17 @@ bcmath try { bcpow('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcpow('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpow(): Argument #1 ($num) is not well-formed -bcpow(): Argument #2 ($exponent) is not well-formed +ValueError: bcpow(): Argument #1 ($num) is not well-formed +ValueError: bcpow(): Argument #2 ($exponent) is not well-formed diff --git a/ext/bcmath/tests/bcpowmod_error.phpt b/ext/bcmath/tests/bcpowmod_error.phpt index ff2862310cb2..99ba973a1df6 100644 --- a/ext/bcmath/tests/bcpowmod_error.phpt +++ b/ext/bcmath/tests/bcpowmod_error.phpt @@ -7,24 +7,24 @@ bcmath try { bcpowmod('a', '1', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcpowmod('1', 'a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcpowmod('1', '1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpowmod(): Argument #1 ($num) is not well-formed -bcpowmod(): Argument #2 ($exponent) is not well-formed -bcpowmod(): Argument #3 ($modulus) is not well-formed +ValueError: bcpowmod(): Argument #1 ($num) is not well-formed +ValueError: bcpowmod(): Argument #2 ($exponent) is not well-formed +ValueError: bcpowmod(): Argument #3 ($modulus) is not well-formed diff --git a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt index 7814e2bd41d8..6589177046f2 100644 --- a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt +++ b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt @@ -8,9 +8,9 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpowmod(): Argument #2 ($exponent) must be greater than or equal to 0 +ValueError: bcpowmod(): Argument #2 ($exponent) must be greater than or equal to 0 diff --git a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt index 8540a0d6df3c..cf757b07757d 100644 --- a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt +++ b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt @@ -8,9 +8,9 @@ bcmath getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/bcmath/tests/bcround_error.phpt b/ext/bcmath/tests/bcround_error.phpt index 95579a4edf09..fe114cf8bba6 100644 --- a/ext/bcmath/tests/bcround_error.phpt +++ b/ext/bcmath/tests/bcround_error.phpt @@ -7,15 +7,15 @@ bcmath try { bcround('hoge'); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcround('0.00.1'); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcround(): Argument #1 ($num) is not well-formed -bcround(): Argument #1 ($num) is not well-formed +ValueError: bcround(): Argument #1 ($num) is not well-formed +ValueError: bcround(): Argument #1 ($num) is not well-formed diff --git a/ext/bcmath/tests/bcround_precision_bounds.phpt b/ext/bcmath/tests/bcround_precision_bounds.phpt index 4c4f910476a7..ad1d6c9fc0f4 100644 --- a/ext/bcmath/tests/bcround_precision_bounds.phpt +++ b/ext/bcmath/tests/bcround_precision_bounds.phpt @@ -8,21 +8,21 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (new BcMath\Number('1'))->round(PHP_INT_MAX); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (new BcMath\Number('1'))->round(2147483648); // INT_MAX + 1 -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -bcround(): Argument #2 ($precision) must be between %i and %d -BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d -BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d +ValueError: bcround(): Argument #2 ($precision) must be between %i and %d +ValueError: BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d +ValueError: BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d diff --git a/ext/bcmath/tests/bcscale_variation001.phpt b/ext/bcmath/tests/bcscale_variation001.phpt index 8d9d32e064b8..e816c499fedf 100644 --- a/ext/bcmath/tests/bcscale_variation001.phpt +++ b/ext/bcmath/tests/bcscale_variation001.phpt @@ -6,13 +6,13 @@ bcmath bcmath.scale=0 --FILE-- getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- 5 -bcscale(): Argument #1 ($scale) must be between 0 and 2147483647 +ValueError: bcscale(): Argument #1 ($scale) must be between 0 and 2147483647 diff --git a/ext/bcmath/tests/bcsqrt_error1.phpt b/ext/bcmath/tests/bcsqrt_error1.phpt index 78923f4a9480..9c8781923b33 100644 --- a/ext/bcmath/tests/bcsqrt_error1.phpt +++ b/ext/bcmath/tests/bcsqrt_error1.phpt @@ -9,9 +9,9 @@ bcmath getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -bcsqrt(): Argument #1 ($num) must be greater than or equal to 0 +ValueError: bcsqrt(): Argument #1 ($num) must be greater than or equal to 0 diff --git a/ext/bcmath/tests/bcsqrt_error2.phpt b/ext/bcmath/tests/bcsqrt_error2.phpt index 1ef934d3bcf1..7e58beca8fcc 100644 --- a/ext/bcmath/tests/bcsqrt_error2.phpt +++ b/ext/bcmath/tests/bcsqrt_error2.phpt @@ -7,10 +7,10 @@ bcmath try { bcsqrt('a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcsqrt(): Argument #1 ($num) is not well-formed +ValueError: bcsqrt(): Argument #1 ($num) is not well-formed diff --git a/ext/bcmath/tests/bcsub_error.phpt b/ext/bcmath/tests/bcsub_error.phpt index 4e1abd3fa950..029423326414 100644 --- a/ext/bcmath/tests/bcsub_error.phpt +++ b/ext/bcmath/tests/bcsub_error.phpt @@ -7,17 +7,17 @@ bcmath try { bcsub('a', '1'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcsub('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcsub(): Argument #1 ($num1) is not well-formed -bcsub(): Argument #2 ($num2) is not well-formed +ValueError: bcsub(): Argument #1 ($num1) is not well-formed +ValueError: bcsub(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/bug60377.phpt b/ext/bcmath/tests/bug60377.phpt index 16d058441a35..ed65e83838d5 100644 --- a/ext/bcmath/tests/bug60377.phpt +++ b/ext/bcmath/tests/bug60377.phpt @@ -9,11 +9,11 @@ if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?> getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $var67 = bcsqrt(0); $var414 = bcadd(0,-1,10); ?> --EXPECT-- -bcscale(): Argument #1 ($scale) must be between 0 and 2147483647 +ValueError: bcscale(): Argument #1 ($scale) must be between 0 and 2147483647 diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt index a424a59e0470..68955985e7e9 100644 --- a/ext/bcmath/tests/bug72093.phpt +++ b/ext/bcmath/tests/bug72093.phpt @@ -6,15 +6,15 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bcpowmod(1, 1.2, 1, 1)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647 -bcpowmod(): Argument #2 ($exponent) cannot have a fractional part +ValueError: bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647 +ValueError: bcpowmod(): Argument #2 ($exponent) cannot have a fractional part diff --git a/ext/bcmath/tests/bug75178.phpt b/ext/bcmath/tests/bug75178.phpt index 940a3567de16..b39c53dfd5df 100644 --- a/ext/bcmath/tests/bug75178.phpt +++ b/ext/bcmath/tests/bug75178.phpt @@ -6,15 +6,15 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bcpowmod('4', '4', '3.1', 3)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpowmod(): Argument #1 ($num) cannot have a fractional part -bcpowmod(): Argument #3 ($modulus) cannot have a fractional part +ValueError: bcpowmod(): Argument #1 ($num) cannot have a fractional part +ValueError: bcpowmod(): Argument #3 ($modulus) cannot have a fractional part diff --git a/ext/bcmath/tests/bug78878.phpt b/ext/bcmath/tests/bug78878.phpt index 9d9d0db48cf4..7ecd7c151e5e 100644 --- a/ext/bcmath/tests/bug78878.phpt +++ b/ext/bcmath/tests/bug78878.phpt @@ -6,9 +6,9 @@ bcmath getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcpowmod(): Argument #3 ($modulus) cannot have a fractional part +ValueError: bcpowmod(): Argument #3 ($modulus) cannot have a fractional part diff --git a/ext/bcmath/tests/bug80545.phpt b/ext/bcmath/tests/bug80545.phpt index f1e256776d93..7b76a883adda 100644 --- a/ext/bcmath/tests/bug80545.phpt +++ b/ext/bcmath/tests/bug80545.phpt @@ -7,17 +7,17 @@ bcmath try { bcadd('a', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcadd('1', 'a'); -} catch (\ValueError $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #2 ($num2) is not well-formed \ No newline at end of file +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/gh15968.phpt b/ext/bcmath/tests/gh15968.phpt index aa91534e7738..4b12b0e6cc41 100644 --- a/ext/bcmath/tests/gh15968.phpt +++ b/ext/bcmath/tests/gh15968.phpt @@ -14,9 +14,9 @@ $a = new BCMath\Number("1"); $b = new MyString(); try { var_dump($a + $b); -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: BcMath\Number + MyString +TypeError: Unsupported operand types: BcMath\Number + MyString diff --git a/ext/bcmath/tests/negative_scale.phpt b/ext/bcmath/tests/negative_scale.phpt index 3b9377559098..0b10fbfc1c3f 100644 --- a/ext/bcmath/tests/negative_scale.phpt +++ b/ext/bcmath/tests/negative_scale.phpt @@ -8,63 +8,63 @@ bcmath.scale=0 getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcsub('1','2',-1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcmul('1','2',-1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcdiv('1','2',-1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcmod('1','2',-1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcpowmod('1', '2', '3', -9); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcpow('1', '2', -1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcsqrt('9', -1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bccomp('1', '2', -1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bcscale(-1); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bcadd(): Argument #3 ($scale) must be between 0 and 2147483647 -bcsub(): Argument #3 ($scale) must be between 0 and 2147483647 -bcmul(): Argument #3 ($scale) must be between 0 and 2147483647 -bcdiv(): Argument #3 ($scale) must be between 0 and 2147483647 -bcmod(): Argument #3 ($scale) must be between 0 and 2147483647 -bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647 -bcpow(): Argument #3 ($scale) must be between 0 and 2147483647 -bcsqrt(): Argument #2 ($scale) must be between 0 and 2147483647 -bccomp(): Argument #3 ($scale) must be between 0 and 2147483647 -bcscale(): Argument #1 ($scale) must be between 0 and 2147483647 +ValueError: bcadd(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcsub(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcmul(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcdiv(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcmod(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647 +ValueError: bcpow(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcsqrt(): Argument #2 ($scale) must be between 0 and 2147483647 +ValueError: bccomp(): Argument #3 ($scale) must be between 0 and 2147483647 +ValueError: bcscale(): Argument #1 ($scale) must be between 0 and 2147483647 diff --git a/ext/bcmath/tests/number/construct_error.phpt b/ext/bcmath/tests/number/construct_error.phpt index 0b49e871cea9..0a05a0b57110 100644 --- a/ext/bcmath/tests/number/construct_error.phpt +++ b/ext/bcmath/tests/number/construct_error.phpt @@ -7,17 +7,17 @@ bcmath try { $num = new BcMath\Number('1'); $num->__construct(5); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num = new BcMath\Number('a'); var_dump($num); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property BcMath\Number::$value -BcMath\Number::__construct(): Argument #1 ($num) is not well-formed +Error: Cannot modify readonly property BcMath\Number::$value +ValueError: BcMath\Number::__construct(): Argument #1 ($num) is not well-formed diff --git a/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt b/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt index 7f64f3101139..256d73f16c3a 100644 --- a/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt +++ b/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt @@ -28,8 +28,8 @@ foreach ($methods as $method) { echo "{$type}:\n"; try { $num->$method($val); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } echo "\n"; @@ -38,11 +38,11 @@ foreach ($methods as $method) { --EXPECTF-- ========== add ========== non number str: -BcMath\Number::add(): Argument #1 ($num) is not well-formed +ValueError: BcMath\Number::add(): Argument #1 ($num) is not well-formed array: -BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s @@ -52,11 +52,11 @@ Deprecated: BcMath\Number::add(): Passing null to parameter #1 ($num) of type Bc ========== sub ========== non number str: -BcMath\Number::sub(): Argument #1 ($num) is not well-formed +ValueError: BcMath\Number::sub(): Argument #1 ($num) is not well-formed array: -BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s @@ -66,11 +66,11 @@ Deprecated: BcMath\Number::sub(): Passing null to parameter #1 ($num) of type Bc ========== mul ========== non number str: -BcMath\Number::mul(): Argument #1 ($num) is not well-formed +ValueError: BcMath\Number::mul(): Argument #1 ($num) is not well-formed array: -BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s @@ -80,43 +80,43 @@ Deprecated: BcMath\Number::mul(): Passing null to parameter #1 ($num) of type Bc ========== div ========== non number str: -BcMath\Number::div(): Argument #1 ($num) is not well-formed +ValueError: BcMath\Number::div(): Argument #1 ($num) is not well-formed array: -BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s -Division by zero +DivisionByZeroError: Division by zero null: Deprecated: BcMath\Number::div(): Passing null to parameter #1 ($num) of type BcMath\Number|string|int is deprecated in %s -Division by zero +DivisionByZeroError: Division by zero ========== mod ========== non number str: -BcMath\Number::mod(): Argument #1 ($num) is not well-formed +ValueError: BcMath\Number::mod(): Argument #1 ($num) is not well-formed array: -BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s -Modulo by zero +DivisionByZeroError: Modulo by zero null: Deprecated: BcMath\Number::mod(): Passing null to parameter #1 ($num) of type BcMath\Number|string|int is deprecated in %s -Modulo by zero +DivisionByZeroError: Modulo by zero ========== pow ========== non number str: -BcMath\Number::pow(): Argument #1 ($exponent) is not well-formed +ValueError: BcMath\Number::pow(): Argument #1 ($exponent) is not well-formed array: -BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s diff --git a/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt b/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt index 35e789f9c103..479e205757b1 100644 --- a/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt +++ b/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt @@ -26,8 +26,8 @@ foreach ($methods as $method) { echo "{$type}:\n"; try { $num->$method(1, $val); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } echo "\n"; @@ -36,54 +36,54 @@ foreach ($methods as $method) { --EXPECTF-- ========== add ========== array: -BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, array given +TypeError: BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, array given other object: -BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, stdClass given +TypeError: BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s ========== sub ========== array: -BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, array given +TypeError: BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, array given other object: -BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, stdClass given +TypeError: BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s ========== mul ========== array: -BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, array given +TypeError: BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, array given other object: -BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, stdClass given +TypeError: BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s ========== div ========== array: -BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, array given +TypeError: BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, array given other object: -BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, stdClass given +TypeError: BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s ========== mod ========== array: -BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, array given +TypeError: BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, array given other object: -BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, stdClass given +TypeError: BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s ========== pow ========== array: -BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, array given +TypeError: BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, array given other object: -BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, stdClass given +TypeError: BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s diff --git a/ext/bcmath/tests/number/methods/compare_arg_error.phpt b/ext/bcmath/tests/number/methods/compare_arg_error.phpt index bf714304d7fd..6af3753f4945 100644 --- a/ext/bcmath/tests/number/methods/compare_arg_error.phpt +++ b/ext/bcmath/tests/number/methods/compare_arg_error.phpt @@ -17,21 +17,21 @@ foreach ($args as [$val, $type]) { echo "{$type}:\n"; try { $num->compare($val); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; } ?> --EXPECTF-- non number str: -BcMath\Number::compare(): Argument #1 ($num) is not well-formed +ValueError: BcMath\Number::compare(): Argument #1 ($num) is not well-formed array: -BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given float: diff --git a/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt b/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt index 6a7099b1c30e..b15005fc4152 100644 --- a/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt +++ b/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt @@ -20,22 +20,22 @@ foreach ($values as $value) { echo "{$value} ** {$exponent}: {$type}\n"; try { $num->pow($exponent); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } ?> --EXPECT-- 0 ** -3: int -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: string -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: object -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -3: int -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: string -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: object -Negative power of zero +DivisionByZeroError: Negative power of zero diff --git a/ext/bcmath/tests/number/methods/powmod_arg_error.phpt b/ext/bcmath/tests/number/methods/powmod_arg_error.phpt index 796769e1e6c4..3b3069296d67 100644 --- a/ext/bcmath/tests/number/methods/powmod_arg_error.phpt +++ b/ext/bcmath/tests/number/methods/powmod_arg_error.phpt @@ -19,8 +19,8 @@ foreach ($args as [$val, $type]) { echo "{$type}:\n"; try { $num->powmod($val, 1); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -31,19 +31,19 @@ foreach ($args as [$val, $type]) { echo "{$type}:\n"; try { $num->powmod(1, $val); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECTF-- ========== check 1st arg ========== non number str: -BcMath\Number::powmod(): Argument #1 ($exponent) is not well-formed +ValueError: BcMath\Number::powmod(): Argument #1 ($exponent) is not well-formed array: -BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s @@ -53,16 +53,16 @@ Deprecated: BcMath\Number::powmod(): Passing null to parameter #1 ($exponent) of ========== check 2nd arg ========== non number str: -BcMath\Number::powmod(): Argument #2 ($modulus) is not well-formed +ValueError: BcMath\Number::powmod(): Argument #2 ($modulus) is not well-formed array: -BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, array given +TypeError: BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, array given other object: -BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, stdClass given +TypeError: BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, stdClass given float: Deprecated: Implicit conversion from float 0.1 to int loses precision in %s -Modulo by zero +DivisionByZeroError: Modulo by zero null: Deprecated: BcMath\Number::powmod(): Passing null to parameter #2 ($modulus) of type BcMath\Number|string|int is deprecated in %s -Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/bcmath/tests/number/operators/calc_array.phpt b/ext/bcmath/tests/number/operators/calc_array.phpt index 31acfb3ad118..4e6389d8bb92 100644 --- a/ext/bcmath/tests/number/operators/calc_array.phpt +++ b/ext/bcmath/tests/number/operators/calc_array.phpt @@ -9,44 +9,44 @@ $array = [1]; try { $num + $array; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num - $array; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num * $array; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / $array; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % $array; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num ** $array; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: BcMath\Number + array -Unsupported operand types: BcMath\Number - array -Unsupported operand types: BcMath\Number * array -Unsupported operand types: BcMath\Number / array -Unsupported operand types: BcMath\Number % array -Unsupported operand types: BcMath\Number ** array +TypeError: Unsupported operand types: BcMath\Number + array +TypeError: Unsupported operand types: BcMath\Number - array +TypeError: Unsupported operand types: BcMath\Number * array +TypeError: Unsupported operand types: BcMath\Number / array +TypeError: Unsupported operand types: BcMath\Number % array +TypeError: Unsupported operand types: BcMath\Number ** array diff --git a/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt b/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt index d9fe499d921d..ebdd9867994a 100644 --- a/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt +++ b/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt @@ -8,44 +8,44 @@ $num = new BcMath\Number(100); try { $num + 'a'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num - 'a'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num * 'a'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / 'a'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % 'a'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num ** 'a'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Right string operand cannot be converted to BcMath\Number -Right string operand cannot be converted to BcMath\Number -Right string operand cannot be converted to BcMath\Number -Right string operand cannot be converted to BcMath\Number -Right string operand cannot be converted to BcMath\Number -Right string operand cannot be converted to BcMath\Number +ValueError: Right string operand cannot be converted to BcMath\Number +ValueError: Right string operand cannot be converted to BcMath\Number +ValueError: Right string operand cannot be converted to BcMath\Number +ValueError: Right string operand cannot be converted to BcMath\Number +ValueError: Right string operand cannot be converted to BcMath\Number +ValueError: Right string operand cannot be converted to BcMath\Number diff --git a/ext/bcmath/tests/number/operators/calc_null.phpt b/ext/bcmath/tests/number/operators/calc_null.phpt index a5745dc5e762..46a3b8bf4a43 100644 --- a/ext/bcmath/tests/number/operators/calc_null.phpt +++ b/ext/bcmath/tests/number/operators/calc_null.phpt @@ -8,44 +8,44 @@ $num = new BcMath\Number(100); try { $num + null; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num - null; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num * null; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / null; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % null; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num ** null; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: BcMath\Number + null -Unsupported operand types: BcMath\Number - null -Unsupported operand types: BcMath\Number * null -Unsupported operand types: BcMath\Number / null -Unsupported operand types: BcMath\Number % null -Unsupported operand types: BcMath\Number ** null +TypeError: Unsupported operand types: BcMath\Number + null +TypeError: Unsupported operand types: BcMath\Number - null +TypeError: Unsupported operand types: BcMath\Number * null +TypeError: Unsupported operand types: BcMath\Number / null +TypeError: Unsupported operand types: BcMath\Number % null +TypeError: Unsupported operand types: BcMath\Number ** null diff --git a/ext/bcmath/tests/number/operators/calc_other_class.phpt b/ext/bcmath/tests/number/operators/calc_other_class.phpt index 5c6a11747def..4b1e6a9917a0 100644 --- a/ext/bcmath/tests/number/operators/calc_other_class.phpt +++ b/ext/bcmath/tests/number/operators/calc_other_class.phpt @@ -9,44 +9,44 @@ $other = new stdClass(); try { $num + $other; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num - $other; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num * $other; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / $other; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % $other; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num ** $other; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: BcMath\Number + stdClass -Unsupported operand types: BcMath\Number - stdClass -Unsupported operand types: BcMath\Number * stdClass -Unsupported operand types: BcMath\Number / stdClass -Unsupported operand types: BcMath\Number % stdClass -Unsupported operand types: BcMath\Number ** stdClass +TypeError: Unsupported operand types: BcMath\Number + stdClass +TypeError: Unsupported operand types: BcMath\Number - stdClass +TypeError: Unsupported operand types: BcMath\Number * stdClass +TypeError: Unsupported operand types: BcMath\Number / stdClass +TypeError: Unsupported operand types: BcMath\Number % stdClass +TypeError: Unsupported operand types: BcMath\Number ** stdClass diff --git a/ext/bcmath/tests/number/operators/calc_undef.phpt b/ext/bcmath/tests/number/operators/calc_undef.phpt index f7b188a8d211..90ce286229cb 100644 --- a/ext/bcmath/tests/number/operators/calc_undef.phpt +++ b/ext/bcmath/tests/number/operators/calc_undef.phpt @@ -8,55 +8,55 @@ $num = new BcMath\Number(100); try { $num + $undef; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num - $undef; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num * $undef; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / $undef; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % $undef; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num ** $undef; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $undef in %s -Unsupported operand types: BcMath\Number + null +TypeError: Unsupported operand types: BcMath\Number + null Warning: Undefined variable $undef in %s -Unsupported operand types: BcMath\Number - null +TypeError: Unsupported operand types: BcMath\Number - null Warning: Undefined variable $undef in %s -Unsupported operand types: BcMath\Number * null +TypeError: Unsupported operand types: BcMath\Number * null Warning: Undefined variable $undef in %s -Unsupported operand types: BcMath\Number / null +TypeError: Unsupported operand types: BcMath\Number / null Warning: Undefined variable $undef in %s -Unsupported operand types: BcMath\Number % null +TypeError: Unsupported operand types: BcMath\Number % null Warning: Undefined variable $undef in %s -Unsupported operand types: BcMath\Number ** null +TypeError: Unsupported operand types: BcMath\Number ** null diff --git a/ext/bcmath/tests/number/operators/div_by_zero.phpt b/ext/bcmath/tests/number/operators/div_by_zero.phpt index cadac7361a2f..16959d243a48 100644 --- a/ext/bcmath/tests/number/operators/div_by_zero.phpt +++ b/ext/bcmath/tests/number/operators/div_by_zero.phpt @@ -8,46 +8,46 @@ $num = new BcMath\Number(100); try { $num / 0; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / '0'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / (new BcMath\Number(0)); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $zero = new BcMath\Number(0); try { 100 / $zero; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { '100' / $zero; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num / $zero; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Division by zero -Division by zero -Division by zero -Division by zero -Division by zero -Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero +DivisionByZeroError: Division by zero diff --git a/ext/bcmath/tests/number/operators/mod_by_zero.phpt b/ext/bcmath/tests/number/operators/mod_by_zero.phpt index 9c1e08f6a4dc..58232fba0122 100644 --- a/ext/bcmath/tests/number/operators/mod_by_zero.phpt +++ b/ext/bcmath/tests/number/operators/mod_by_zero.phpt @@ -8,46 +8,46 @@ $num = new BcMath\Number(100); try { $num % 0; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % '0'; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % (new BcMath\Number(0)); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $zero = new BcMath\Number(0); try { 100 % $zero; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { '100' % $zero; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num % $zero; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Modulo by zero -Modulo by zero -Modulo by zero -Modulo by zero -Modulo by zero -Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero +DivisionByZeroError: Modulo by zero diff --git a/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt b/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt index ff03626fca60..7dd98fdea61e 100644 --- a/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt +++ b/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt @@ -20,22 +20,22 @@ foreach ($values as $value) { echo "{$value} ** {$exponent}: {$type}\n"; try { $num ** $exponent; - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } ?> --EXPECT-- 0 ** -3: int -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: string -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: object -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -3: int -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: string -Negative power of zero +DivisionByZeroError: Negative power of zero 0 ** -2: object -Negative power of zero +DivisionByZeroError: Negative power of zero diff --git a/ext/bcmath/tests/number/properties_unknown.phpt b/ext/bcmath/tests/number/properties_unknown.phpt index cd1c13eb0c74..f98e97477a57 100644 --- a/ext/bcmath/tests/number/properties_unknown.phpt +++ b/ext/bcmath/tests/number/properties_unknown.phpt @@ -11,16 +11,16 @@ var_dump($num->foo); try { $num->foo = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($num->foo); try { $num->bar = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(isset($num->foo)); @@ -28,9 +28,9 @@ var_dump(isset($num->foo)); --EXPECTF-- Warning: Undefined property: BcMath\Number::$foo in %s NULL -Cannot create dynamic property BcMath\Number::$foo +Error: Cannot create dynamic property BcMath\Number::$foo Warning: Undefined property: BcMath\Number::$foo in %s NULL -Cannot create dynamic property BcMath\Number::$bar +Error: Cannot create dynamic property BcMath\Number::$bar bool(false) diff --git a/ext/bcmath/tests/number/properties_unset.phpt b/ext/bcmath/tests/number/properties_unset.phpt index ce21350240bb..12dcf4b6e686 100644 --- a/ext/bcmath/tests/number/properties_unset.phpt +++ b/ext/bcmath/tests/number/properties_unset.phpt @@ -8,16 +8,16 @@ bcmath $num = new BcMath\Number(1); try { unset($num->value); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($num->scale); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot unset readonly property BcMath\Number::$value -Cannot unset readonly property BcMath\Number::$scale +Error: Cannot unset readonly property BcMath\Number::$value +Error: Cannot unset readonly property BcMath\Number::$scale diff --git a/ext/bcmath/tests/number/properties_write_error.phpt b/ext/bcmath/tests/number/properties_write_error.phpt index 03683c4c0926..f92cccf2e125 100644 --- a/ext/bcmath/tests/number/properties_write_error.phpt +++ b/ext/bcmath/tests/number/properties_write_error.phpt @@ -8,16 +8,16 @@ bcmath $num = new BcMath\Number(1); try { $num->value = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $num->scale = 1; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property BcMath\Number::$value -Cannot modify readonly property BcMath\Number::$scale +Error: Cannot modify readonly property BcMath\Number::$value +Error: Cannot modify readonly property BcMath\Number::$scale diff --git a/ext/bcmath/tests/number/unserialize_error.phpt b/ext/bcmath/tests/number/unserialize_error.phpt index 030ba1232d06..8351fe72336a 100644 --- a/ext/bcmath/tests/number/unserialize_error.phpt +++ b/ext/bcmath/tests/number/unserialize_error.phpt @@ -7,8 +7,8 @@ bcmath try { $num = new BcMath\Number(1); $num->__unserialize(['value' => '5']); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -22,15 +22,15 @@ $cases = [ foreach ($cases as $case) { try { unserialize($case); - } catch (Exception $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Cannot modify readonly property BcMath\Number::$value +Error: Cannot modify readonly property BcMath\Number::$value -Invalid serialization data for BcMath\Number object -Invalid serialization data for BcMath\Number object -Invalid serialization data for BcMath\Number object -Invalid serialization data for BcMath\Number object +Exception: Invalid serialization data for BcMath\Number object +Exception: Invalid serialization data for BcMath\Number object +Exception: Invalid serialization data for BcMath\Number object +Exception: Invalid serialization data for BcMath\Number object diff --git a/ext/bcmath/tests/sec_embedded_null_truncation.phpt b/ext/bcmath/tests/sec_embedded_null_truncation.phpt index 157810ecbb3a..20e3cf432ce2 100644 --- a/ext/bcmath/tests/sec_embedded_null_truncation.phpt +++ b/ext/bcmath/tests/sec_embedded_null_truncation.phpt @@ -26,34 +26,34 @@ foreach ($cases as $s) { try { $fn($s); echo "FAIL: accepted\n"; - } catch (\ValueError $e) { - echo $e->getMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } ?> --EXPECT-- -bcadd(): Argument #1 ($num1) is not well-formed -bcsub(): Argument #1 ($num1) is not well-formed -bcmul(): Argument #1 ($num1) is not well-formed -bcdiv(): Argument #1 ($num1) is not well-formed -bcmod(): Argument #1 ($num1) is not well-formed -bcpow(): Argument #1 ($num) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed -bcsqrt(): Argument #1 ($num) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed -bcsub(): Argument #1 ($num1) is not well-formed -bcmul(): Argument #1 ($num1) is not well-formed -bcdiv(): Argument #1 ($num1) is not well-formed -bcmod(): Argument #1 ($num1) is not well-formed -bcpow(): Argument #1 ($num) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed -bcsqrt(): Argument #1 ($num) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed -bcsub(): Argument #1 ($num1) is not well-formed -bcmul(): Argument #1 ($num1) is not well-formed -bcdiv(): Argument #1 ($num1) is not well-formed -bcmod(): Argument #1 ($num1) is not well-formed -bcpow(): Argument #1 ($num) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed -bcsqrt(): Argument #1 ($num) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcsub(): Argument #1 ($num1) is not well-formed +ValueError: bcmul(): Argument #1 ($num1) is not well-formed +ValueError: bcdiv(): Argument #1 ($num1) is not well-formed +ValueError: bcmod(): Argument #1 ($num1) is not well-formed +ValueError: bcpow(): Argument #1 ($num) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bcsqrt(): Argument #1 ($num) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcsub(): Argument #1 ($num1) is not well-formed +ValueError: bcmul(): Argument #1 ($num1) is not well-formed +ValueError: bcdiv(): Argument #1 ($num1) is not well-formed +ValueError: bcmod(): Argument #1 ($num1) is not well-formed +ValueError: bcpow(): Argument #1 ($num) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bcsqrt(): Argument #1 ($num) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcsub(): Argument #1 ($num1) is not well-formed +ValueError: bcmul(): Argument #1 ($num1) is not well-formed +ValueError: bcdiv(): Argument #1 ($num1) is not well-formed +ValueError: bcmod(): Argument #1 ($num1) is not well-formed +ValueError: bcpow(): Argument #1 ($num) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bcsqrt(): Argument #1 ($num) is not well-formed diff --git a/ext/bcmath/tests/str2num_formatting.phpt b/ext/bcmath/tests/str2num_formatting.phpt index 4b77381de868..3cf4e5fc67a1 100644 --- a/ext/bcmath/tests/str2num_formatting.phpt +++ b/ext/bcmath/tests/str2num_formatting.phpt @@ -18,38 +18,38 @@ echo "\n"; try { echo bcadd(" 0", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bcadd("1e1", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bcadd("1,1", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bcadd("Hello", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bcadd("1 1", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bcadd("1.a", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -64,32 +64,32 @@ echo "\n"; try { echo bccomp(" 0", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bccomp("1e1", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bccomp("1,1", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bccomp("Hello", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo bccomp("1 1", "2"); -} catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -100,12 +100,12 @@ try { 2 2 -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed -bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed +ValueError: bcadd(): Argument #1 ($num1) is not well-formed -1 -1 @@ -113,8 +113,8 @@ bcadd(): Argument #1 ($num1) is not well-formed -1 -1 -bccomp(): Argument #1 ($num1) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed -bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed +ValueError: bccomp(): Argument #1 ($num1) is not well-formed From 6ee03f89c3417bb53dc8a9de23744c6201f35548 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:08:25 +0700 Subject: [PATCH 11/27] ext/xmlreader: applied fixers to improve test robustness (#23035) --- ext/xmlreader/tests/001.phpt | 6 ++-- ext/xmlreader/tests/002.phpt | 6 ++-- ext/xmlreader/tests/003-get-errors.phpt | 6 ++-- ext/xmlreader/tests/003-move-errors.phpt | 6 ++-- ext/xmlreader/tests/003.phpt | 6 ++-- ext/xmlreader/tests/007.phpt | 6 ++-- ext/xmlreader/tests/014.phpt | 18 +++++------ ext/xmlreader/tests/015-get-errors.phpt | 6 ++-- ext/xmlreader/tests/015-move-errors.phpt | 6 ++-- ext/xmlreader/tests/bug73246.phpt | 18 +++++------ ext/xmlreader/tests/bug81521.phpt | 12 ++++---- ext/xmlreader/tests/expand_error.phpt | 6 ++-- .../tests/fromStream_custom_constructor.phpt | 6 ++-- .../fromStream_custom_constructor_error.phpt | 4 +-- .../tests/fromString_custom_constructor.phpt | 6 ++-- .../fromString_custom_constructor_error.phpt | 4 +-- .../fromUri_custom_constructor_error.phpt | 8 ++--- ext/xmlreader/tests/invalid_encoding.phpt | 18 +++++------ ext/xmlreader/tests/next_basic.phpt | 12 ++++---- .../tests/setParserProperty_error.phpt | 6 ++-- ext/xmlreader/tests/setSchema_error.phpt | 18 +++++------ ext/xmlreader/tests/virtual_properties3.phpt | 30 +++++++++---------- 22 files changed, 107 insertions(+), 107 deletions(-) diff --git a/ext/xmlreader/tests/001.phpt b/ext/xmlreader/tests/001.phpt index ab84cd0b3a22..50e3aa97f378 100644 --- a/ext/xmlreader/tests/001.phpt +++ b/ext/xmlreader/tests/001.phpt @@ -20,12 +20,12 @@ $reader = new XMLReader(); try { $reader->XML($xmlstring); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- books books -XMLReader::XML(): Argument #1 ($source) must not be empty +ValueError: XMLReader::XML(): Argument #1 ($source) must not be empty diff --git a/ext/xmlreader/tests/002.phpt b/ext/xmlreader/tests/002.phpt index a0f55a2af3b4..5ee80945ddda 100644 --- a/ext/xmlreader/tests/002.phpt +++ b/ext/xmlreader/tests/002.phpt @@ -12,8 +12,8 @@ file_put_contents($filename, $xmlstring); $reader = new XMLReader(); try { $reader->open(''); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader = new XMLReader(); @@ -36,6 +36,6 @@ unlink($filename); ?> --EXPECT-- -XMLReader::open(): Argument #1 ($uri) must not be empty +ValueError: XMLReader::open(): Argument #1 ($uri) must not be empty books books diff --git a/ext/xmlreader/tests/003-get-errors.phpt b/ext/xmlreader/tests/003-get-errors.phpt index 6cb2f20b8d5f..9e5b1c32c7db 100644 --- a/ext/xmlreader/tests/003-get-errors.phpt +++ b/ext/xmlreader/tests/003-get-errors.phpt @@ -33,8 +33,8 @@ while ($reader->read()) { // Test for call with an empty string argument try { $reader->getAttribute(''); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } // Ensure that node pointer has not changed position @@ -69,7 +69,7 @@ unlink(__DIR__.'/003-get-errors.xml'); book bool(true) num: 1 -XMLReader::getAttribute(): Argument #1 ($name) must not be empty +ValueError: XMLReader::getAttribute(): Argument #1 ($name) must not be empty num: 1 NULL num: 1 diff --git a/ext/xmlreader/tests/003-move-errors.phpt b/ext/xmlreader/tests/003-move-errors.phpt index be36d252c453..a9ef7ed6701f 100644 --- a/ext/xmlreader/tests/003-move-errors.phpt +++ b/ext/xmlreader/tests/003-move-errors.phpt @@ -33,8 +33,8 @@ while ($reader->read()) { // Test for call with an empty string argument try { $reader->moveToAttribute(''); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } // Ensure that node pointer has not changed position @@ -68,7 +68,7 @@ unlink(__DIR__.'/003-move-errors.xml'); book bool(true) num: 1 -XMLReader::moveToAttribute(): Argument #1 ($name) must not be empty +ValueError: XMLReader::moveToAttribute(): Argument #1 ($name) must not be empty num: 1 bool(false) num: 1 diff --git a/ext/xmlreader/tests/003.phpt b/ext/xmlreader/tests/003.phpt index a581d0dea02d..1ad4c088dd84 100644 --- a/ext/xmlreader/tests/003.phpt +++ b/ext/xmlreader/tests/003.phpt @@ -70,8 +70,8 @@ while ($reader->read()) { var_dump($reader->moveToAttribute('missing-attribute')); try { $reader->moveToAttribute(''); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } } @@ -88,4 +88,4 @@ num: 1 idx: 2 bool(false) bool(false) -XMLReader::moveToAttribute(): Argument #1 ($name) must not be empty +ValueError: XMLReader::moveToAttribute(): Argument #1 ($name) must not be empty diff --git a/ext/xmlreader/tests/007.phpt b/ext/xmlreader/tests/007.phpt index e9705cc5af66..1cc339e09729 100644 --- a/ext/xmlreader/tests/007.phpt +++ b/ext/xmlreader/tests/007.phpt @@ -44,8 +44,8 @@ $reader->XML($xmlstring); try { $reader->setRelaxNGSchema(''); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader->close(); @@ -53,4 +53,4 @@ $reader->close(); --EXPECT-- file relaxNG: ok string relaxNG: ok -XMLReader::setRelaxNGSchema(): Argument #1 ($filename) must not be empty +ValueError: XMLReader::setRelaxNGSchema(): Argument #1 ($filename) must not be empty diff --git a/ext/xmlreader/tests/014.phpt b/ext/xmlreader/tests/014.phpt index 26886ae26e6e..b28e418ffe74 100644 --- a/ext/xmlreader/tests/014.phpt +++ b/ext/xmlreader/tests/014.phpt @@ -26,21 +26,21 @@ while ($reader->read()) { // Try to set the value of the element from book1 to movie1 try { $reader->value = 'movie1'; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } // Try to set the value of the first "num" attribute from "1" to "num attribute 1" $attr = $reader->moveToFirstAttribute(); try { $reader->value = 'num attribute 1'; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } // Try to set the name of the first attribute from "num" to "number" try { $reader->name = 'number'; - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } } @@ -54,6 +54,6 @@ $reader->close(); unlink(__DIR__.'/_014.xml'); ?> --EXPECT-- -Cannot modify readonly property XMLReader::$value -Cannot modify readonly property XMLReader::$value -Cannot modify readonly property XMLReader::$name +Error: Cannot modify readonly property XMLReader::$value +Error: Cannot modify readonly property XMLReader::$value +Error: Cannot modify readonly property XMLReader::$name diff --git a/ext/xmlreader/tests/015-get-errors.phpt b/ext/xmlreader/tests/015-get-errors.phpt index 3cf6134df205..720503909fce 100644 --- a/ext/xmlreader/tests/015-get-errors.phpt +++ b/ext/xmlreader/tests/015-get-errors.phpt @@ -28,8 +28,8 @@ while ($reader->read()) { // Test for missing namespace argument try { $attr = $reader->getAttributeNs('idx', null); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo $reader->name . ": "; @@ -47,5 +47,5 @@ unlink(__DIR__.'/015-get-errors.xml'); ?> --EXPECTF-- Deprecated: XMLReader::getAttributeNs(): Passing null to parameter #2 ($namespace) of type string is deprecated in %s on line %d -XMLReader::getAttributeNs(): Argument #2 ($namespace) must not be empty +ValueError: XMLReader::getAttributeNs(): Argument #2 ($namespace) must not be empty ns1:num: 1 diff --git a/ext/xmlreader/tests/015-move-errors.phpt b/ext/xmlreader/tests/015-move-errors.phpt index d885c5a6fe97..06bb9c2f086b 100644 --- a/ext/xmlreader/tests/015-move-errors.phpt +++ b/ext/xmlreader/tests/015-move-errors.phpt @@ -26,8 +26,8 @@ while ($reader->read()) { // Test for missing namespace argument try { $reader->moveToAttributeNs('idx', null); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } } @@ -42,4 +42,4 @@ unlink(__DIR__.'/015-move-errors.xml'); ?> --EXPECTF-- Deprecated: XMLReader::moveToAttributeNs(): Passing null to parameter #2 ($namespace) of type string is deprecated in %s on line %d -XMLReader::moveToAttributeNs(): Argument #2 ($namespace) must not be empty +ValueError: XMLReader::moveToAttributeNs(): Argument #2 ($namespace) must not be empty diff --git a/ext/xmlreader/tests/bug73246.phpt b/ext/xmlreader/tests/bug73246.phpt index f20c16045386..95ba538506a9 100644 --- a/ext/xmlreader/tests/bug73246.phpt +++ b/ext/xmlreader/tests/bug73246.phpt @@ -7,21 +7,21 @@ xmlreader $reader = new XMLReader(); try { $reader->open(__FILE__, "UTF\0-8"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $reader->XML('', "UTF\0-8"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { XMLReader::fromStream(fopen('php://memory', 'r'), encoding: "UTF\0-8"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -XMLReader::open(): Argument #2 ($encoding) must not contain any null bytes -XMLReader::XML(): Argument #2 ($encoding) must not contain any null bytes -XMLReader::fromStream(): Argument #2 ($encoding) must not contain any null bytes +ValueError: XMLReader::open(): Argument #2 ($encoding) must not contain any null bytes +ValueError: XMLReader::XML(): Argument #2 ($encoding) must not contain any null bytes +ValueError: XMLReader::fromStream(): Argument #2 ($encoding) must not contain any null bytes diff --git a/ext/xmlreader/tests/bug81521.phpt b/ext/xmlreader/tests/bug81521.phpt index 2789a16e21bb..d1547e8d2d26 100644 --- a/ext/xmlreader/tests/bug81521.phpt +++ b/ext/xmlreader/tests/bug81521.phpt @@ -7,15 +7,15 @@ xmlreader $reader = new XMLReader(); try { var_dump($reader->setParserProperty(XMLReader::LOADDTD, 1)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($reader->getParserProperty(XMLReader::LOADDTD)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access parser properties before loading data -Cannot access parser properties before loading data +Error: Cannot access parser properties before loading data +Error: Cannot access parser properties before loading data diff --git a/ext/xmlreader/tests/expand_error.phpt b/ext/xmlreader/tests/expand_error.phpt index 1eba483733a2..210ee30356a7 100644 --- a/ext/xmlreader/tests/expand_error.phpt +++ b/ext/xmlreader/tests/expand_error.phpt @@ -17,8 +17,8 @@ $reader = new XMLReader(); try { $reader->expand(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader->close(); @@ -29,7 +29,7 @@ var_dump($reader->expand()); $reader->close(); ?> --EXPECTF-- -Data must be loaded before expanding +Error: Data must be loaded before expanding Warning: XMLReader::expand(): An Error Occurred while expanding in %s on line %d bool(false) diff --git a/ext/xmlreader/tests/fromStream_custom_constructor.phpt b/ext/xmlreader/tests/fromStream_custom_constructor.phpt index 3ec370274ad3..2519c6b3349b 100644 --- a/ext/xmlreader/tests/fromStream_custom_constructor.phpt +++ b/ext/xmlreader/tests/fromStream_custom_constructor.phpt @@ -20,8 +20,8 @@ fseek($h, 0); $reader = CustomXMLReader::fromStream($h, encoding: "UTF-8"); try { var_dump($reader); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($reader->read()); var_dump($reader->nodeType); @@ -60,6 +60,6 @@ object(CustomXMLReader)#%d (14) { ["xmlLang"]=> string(0) "" } -Failed to read property because no XML data has been read yet +Error: Failed to read property because no XML data has been read yet bool(true) int(1) diff --git a/ext/xmlreader/tests/fromStream_custom_constructor_error.phpt b/ext/xmlreader/tests/fromStream_custom_constructor_error.phpt index 60e65fa92117..e5d04efaaeef 100644 --- a/ext/xmlreader/tests/fromStream_custom_constructor_error.phpt +++ b/ext/xmlreader/tests/fromStream_custom_constructor_error.phpt @@ -17,10 +17,10 @@ fseek($h, 0); try { CustomXMLReader::fromStream($h, encoding: "UTF-8"); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } fclose($h); ?> --EXPECT-- -nope +Error: nope diff --git a/ext/xmlreader/tests/fromString_custom_constructor.phpt b/ext/xmlreader/tests/fromString_custom_constructor.phpt index 4299544613d4..9eddbb3061e8 100644 --- a/ext/xmlreader/tests/fromString_custom_constructor.phpt +++ b/ext/xmlreader/tests/fromString_custom_constructor.phpt @@ -16,8 +16,8 @@ class CustomXMLReader extends XMLReader { $reader = CustomXMLReader::fromString(""); try { var_dump($reader); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($reader->read()); var_dump($reader->nodeType); @@ -54,6 +54,6 @@ object(CustomXMLReader)#%d (14) { ["xmlLang"]=> string(0) "" } -Failed to read property because no XML data has been read yet +Error: Failed to read property because no XML data has been read yet bool(true) int(1) diff --git a/ext/xmlreader/tests/fromString_custom_constructor_error.phpt b/ext/xmlreader/tests/fromString_custom_constructor_error.phpt index 9bcffddba70d..0db74a843732 100644 --- a/ext/xmlreader/tests/fromString_custom_constructor_error.phpt +++ b/ext/xmlreader/tests/fromString_custom_constructor_error.phpt @@ -13,8 +13,8 @@ class CustomXMLReader extends XMLReader { try { CustomXMLReader::fromString(""); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -nope +Error: nope diff --git a/ext/xmlreader/tests/fromUri_custom_constructor_error.phpt b/ext/xmlreader/tests/fromUri_custom_constructor_error.phpt index ad36c1e0c22f..9aa7ffa02d99 100644 --- a/ext/xmlreader/tests/fromUri_custom_constructor_error.phpt +++ b/ext/xmlreader/tests/fromUri_custom_constructor_error.phpt @@ -13,7 +13,7 @@ class CustomXMLReader extends XMLReader { try { CustomXMLReader::fromUri("nonexistent"); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $filename = __DIR__ . '/_fromUri_custom_constructor_error.xml'; @@ -24,12 +24,12 @@ file_put_contents($filename, $xmlstring); try { CustomXMLReader::fromUri($filename); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unable to open source data -nope +Error: Unable to open source data +Error: nope --CLEAN-- open(__FILE__, "does not exist"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $h = fopen("php://memory", "w+"); try { XMLReader::fromStream($h, encoding: "does not exist"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } fclose($h); try { $reader->XML('', "does not exist"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -XMLReader::open(): Argument #2 ($encoding) must be a valid character encoding -XMLReader::fromStream(): Argument #2 ($encoding) must be a valid character encoding -XMLReader::XML(): Argument #2 ($encoding) must be a valid character encoding +ValueError: XMLReader::open(): Argument #2 ($encoding) must be a valid character encoding +ValueError: XMLReader::fromStream(): Argument #2 ($encoding) must be a valid character encoding +ValueError: XMLReader::XML(): Argument #2 ($encoding) must be a valid character encoding diff --git a/ext/xmlreader/tests/next_basic.phpt b/ext/xmlreader/tests/next_basic.phpt index 0cf907bcd4eb..891acc9c4fec 100644 --- a/ext/xmlreader/tests/next_basic.phpt +++ b/ext/xmlreader/tests/next_basic.phpt @@ -12,14 +12,14 @@ $reader = new XMLReader(); try { $reader->read(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $reader->next(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader->close(); @@ -40,8 +40,8 @@ $reader->close(); ?> --EXPECT-- -Data must be loaded before reading -Data must be loaded before reading +Error: Data must be loaded before reading +Error: Data must be loaded before reading node1 bool(true) node3 diff --git a/ext/xmlreader/tests/setParserProperty_error.phpt b/ext/xmlreader/tests/setParserProperty_error.phpt index 292745751e7f..44e26223a44f 100644 --- a/ext/xmlreader/tests/setParserProperty_error.phpt +++ b/ext/xmlreader/tests/setParserProperty_error.phpt @@ -12,10 +12,10 @@ $reader = new XMLReader(); $reader->XML($xml); try { $reader->setParserProperty(-1, true); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader->close(); ?> --EXPECT-- -XMLReader::setParserProperty(): Argument #1 ($property) must be a valid parser property +ValueError: XMLReader::setParserProperty(): Argument #1 ($property) must be a valid parser property diff --git a/ext/xmlreader/tests/setSchema_error.phpt b/ext/xmlreader/tests/setSchema_error.phpt index a586c38f5532..10a1f301530c 100644 --- a/ext/xmlreader/tests/setSchema_error.phpt +++ b/ext/xmlreader/tests/setSchema_error.phpt @@ -8,24 +8,24 @@ xmlreader $reader = new XMLReader(); try { $reader->setSchema(''); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader->close(); $reader = new XMLReader(); try { $reader->setSchema('schema-missing-file.xsd'); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader->close(); $reader = new XMLReader(); try { $reader->setSchema('schema-empty.xsd'); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $reader = new XMLReader(); @@ -37,7 +37,7 @@ var_dump(@$reader->setSchema('schema-bad.xsd')); $reader->close(); ?> --EXPECT-- -XMLReader::setSchema(): Argument #1 ($filename) must not be empty -Schema must be set prior to reading -Schema must be set prior to reading +ValueError: XMLReader::setSchema(): Argument #1 ($filename) must not be empty +Error: Schema must be set prior to reading +Error: Schema must be set prior to reading bool(false) diff --git a/ext/xmlreader/tests/virtual_properties3.phpt b/ext/xmlreader/tests/virtual_properties3.phpt index ad016c4db764..c4f6ce226eb7 100644 --- a/ext/xmlreader/tests/virtual_properties3.phpt +++ b/ext/xmlreader/tests/virtual_properties3.phpt @@ -14,32 +14,32 @@ $reader = new MyXMLReader(); try { unset($reader->attributeCount); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($reader->baseURI); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($reader->depth); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($reader->hasAttributes); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($reader->hasValue); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($reader->x); @@ -47,9 +47,9 @@ var_dump(isset($reader->x)); ?> --EXPECT-- -Cannot unset MyXMLReader::$attributeCount -Cannot unset MyXMLReader::$baseURI -Cannot unset MyXMLReader::$depth -Cannot unset MyXMLReader::$hasAttributes -Cannot unset MyXMLReader::$hasValue +Error: Cannot unset MyXMLReader::$attributeCount +Error: Cannot unset MyXMLReader::$baseURI +Error: Cannot unset MyXMLReader::$depth +Error: Cannot unset MyXMLReader::$hasAttributes +Error: Cannot unset MyXMLReader::$hasValue bool(false) From bd044a29bf1664625db030f4179ef54a8db53082 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:11:35 +0700 Subject: [PATCH 12/27] Zend: applied fixers to improve test robustness (part 1/8) (#23308) --- .../access_modifiers_008.phpt | 12 ++-- Zend/tests/add_002.phpt | 6 +- Zend/tests/add_003.phpt | 6 +- Zend/tests/add_004.phpt | 6 +- Zend/tests/add_006.phpt | 12 ++-- Zend/tests/add_007.phpt | 6 +- Zend/tests/arg_unpack/invalid_type.phpt | 20 +++---- Zend/tests/arg_unpack/non_integer_keys.phpt | 6 +- Zend/tests/arg_unpack/string_keys.phpt | 6 +- .../traversable_throwing_exception.phpt | 8 +-- .../array_literal_next_element_error.phpt | 12 ++-- ...ray_merge_recursive_next_key_overflow.phpt | 8 +-- Zend/tests/array_unpack/already_occupied.phpt | 18 +++--- Zend/tests/array_unpack/classes.phpt | 6 +- Zend/tests/array_unpack/non_integer_keys.phpt | 6 +- Zend/tests/arrow_functions/006.phpt | 12 ++-- Zend/tests/arrow_functions/007.phpt | 12 ++-- Zend/tests/arrow_functions/gh7900.phpt | 12 ++-- Zend/tests/assert/bug70528.phpt | 18 +++--- Zend/tests/assert/bug71922.phpt | 6 +- Zend/tests/assert/expect_003.phpt | 6 +- Zend/tests/assert/expect_004.phpt | 6 +- Zend/tests/assert/expect_005.phpt | 4 +- Zend/tests/assert/expect_015.phpt | 36 +++++------ Zend/tests/assert/expect_016.phpt | 6 +- Zend/tests/assert/expect_018.phpt | 12 ++-- Zend/tests/assign_dim_obj_null_return.phpt | 60 +++++++++---------- Zend/tests/assign_op_type_error.phpt | 48 +++++++-------- Zend/tests/assign_property_null_object.phpt | 6 +- Zend/tests/assign_ref_error_var_handling.phpt | 12 ++-- Zend/tests/assign_to_obj_002.phpt | 4 +- .../ast/ast_serialize_backtick_literal.phpt | 6 +- Zend/tests/ast/ast_serialize_floats.phpt | 18 +++--- Zend/tests/ast/gh21072.phpt | 4 +- Zend/tests/ast/zend-pow-assign.phpt | 6 +- Zend/tests/asymmetric_visibility/__set.phpt | 12 ++-- Zend/tests/asymmetric_visibility/__unset.phpt | 8 +-- .../asymmetric_visibility/ast_printing.phpt | 6 +- Zend/tests/asymmetric_visibility/bug001.phpt | 6 +- Zend/tests/asymmetric_visibility/bug002.phpt | 6 +- Zend/tests/asymmetric_visibility/bug003.phpt | 12 ++-- .../asymmetric_visibility/cpp_private.phpt | 6 +- .../asymmetric_visibility/cpp_protected.phpt | 6 +- Zend/tests/asymmetric_visibility/dim_add.phpt | 6 +- .../optimizer_shared_cache_slot.phpt | 8 +-- Zend/tests/asymmetric_visibility/private.phpt | 18 +++--- .../asymmetric_visibility/protected.phpt | 12 ++-- .../tests/asymmetric_visibility/readonly.phpt | 24 ++++---- .../asymmetric_visibility/reference.phpt | 6 +- .../asymmetric_visibility/reference_2.phpt | 12 ++-- .../scope_rebinding.phpt | 12 ++-- .../asymmetric_visibility/static_props.phpt | 56 ++++++++--------- Zend/tests/asymmetric_visibility/unset.phpt | 12 ++-- .../unshared_rw_cache_slot.phpt | 12 ++-- Zend/tests/attributes/003_ast_nodes.phpt | 12 ++-- Zend/tests/attributes/005_objects.phpt | 35 +++++------ Zend/tests/attributes/006_filter.phpt | 14 ++--- Zend/tests/attributes/013_class_scope.phpt | 7 +-- .../020_userland_attribute_validation.phpt | 10 ++-- ...021_attribute_flags_type_is_validated.phpt | 6 +- ...22_attribute_flags_value_is_validated.phpt | 6 +- .../023_ast_node_in_validation.phpt | 6 +- .../has_runtime_errors.phpt | 4 +- .../opcache_validator_errors.phpt | 4 +- .../validator_AllowDynamicProperties.phpt | 4 +- .../validator_Attribute.phpt | 4 +- .../validator_Deprecated.phpt | 4 +- .../validator_NoDiscard.phpt | 4 +- .../deprecated_constant_as_message_002.phpt | 12 ++-- .../deprecated/constants/const_messages.phpt | 1 - .../deprecated_constant_as_message_002.phpt | 12 ++-- .../functions/throwing_error_handler_001.phpt | 36 +++++------ .../functions/throwing_error_handler_002.phpt | 6 +- .../functions/throwing_error_handler_003.phpt | 6 +- Zend/tests/attributes/nodiscard/002.phpt | 1 - .../nodiscard/throwing_error_handler_001.phpt | 12 ++-- Zend/tests/attributes/ossfuzz371445205.phpt | 6 +- .../debug_print_backtrace_from_main.phpt | 1 - Zend/tests/bind_static_exception.phpt | 6 +- .../bitwise_not_precision_exception.phpt | 6 +- Zend/tests/bug26229.phpt | 6 +- Zend/tests/bug31098.phpt | 16 ++--- Zend/tests/bug31720.phpt | 6 +- Zend/tests/bug33996.phpt | 8 +-- Zend/tests/bug37811.phpt | 6 +- Zend/tests/bug44660.phpt | 30 +++++----- Zend/tests/bug46106.phpt | 6 +- 87 files changed, 481 insertions(+), 494 deletions(-) diff --git a/Zend/tests/access_modifiers/access_modifiers_008.phpt b/Zend/tests/access_modifiers/access_modifiers_008.phpt index 1cce8767d850..57c555bb6345 100644 --- a/Zend/tests/access_modifiers/access_modifiers_008.phpt +++ b/Zend/tests/access_modifiers/access_modifiers_008.phpt @@ -33,18 +33,18 @@ class B2 extends A { try { echo A::mp() . "\n"; } catch (\Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo B1::ma() . "\n"; // protected method defined also in A try { echo B1::mp() . "\n"; // protected method defined also in A but as private } catch (\Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo B1::mb() . "\n"; } catch (\Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -54,7 +54,7 @@ B2::test(); ?> --EXPECT-- A::ma() -Call to private method A::mp() from scope B2 +Error: Call to private method A::mp() from scope B2 B1::ma() -Call to protected method B1::mp() from scope B2 -Call to protected method B1::mb() from scope B2 +Error: Call to protected method B1::mp() from scope B2 +Error: Call to protected method B1::mb() from scope B2 diff --git a/Zend/tests/add_002.phpt b/Zend/tests/add_002.phpt index 9077ece08587..627e210d0f17 100644 --- a/Zend/tests/add_002.phpt +++ b/Zend/tests/add_002.phpt @@ -10,8 +10,8 @@ $o->prop = "value"; try { var_dump($a + $o); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $a + $o; @@ -20,7 +20,7 @@ var_dump($c); echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: array + stdClass +TypeError: Unsupported operand types: array + stdClass Fatal error: Uncaught TypeError: Unsupported operand types: array + stdClass in %s:%d Stack trace: diff --git a/Zend/tests/add_003.phpt b/Zend/tests/add_003.phpt index 6d27863e893f..6472a050bf9d 100644 --- a/Zend/tests/add_003.phpt +++ b/Zend/tests/add_003.phpt @@ -10,8 +10,8 @@ $o->prop = "value"; try { var_dump($o + $a); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $o + $a; @@ -20,7 +20,7 @@ var_dump($c); echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: stdClass + array +TypeError: Unsupported operand types: stdClass + array Fatal error: Uncaught TypeError: Unsupported operand types: stdClass + array in %s:%d Stack trace: diff --git a/Zend/tests/add_004.phpt b/Zend/tests/add_004.phpt index 2f16f10eaf50..dbdd26cad75a 100644 --- a/Zend/tests/add_004.phpt +++ b/Zend/tests/add_004.phpt @@ -7,8 +7,8 @@ $a = array(1,2,3); try { var_dump($a + 5); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $a + 5; @@ -17,7 +17,7 @@ var_dump($c); echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: array + int +TypeError: Unsupported operand types: array + int Fatal error: Uncaught TypeError: Unsupported operand types: array + int in %s:%d Stack trace: diff --git a/Zend/tests/add_006.phpt b/Zend/tests/add_006.phpt index 09945f3fce6c..f51397cbec7c 100644 --- a/Zend/tests/add_006.phpt +++ b/Zend/tests/add_006.phpt @@ -14,8 +14,8 @@ $s4 = "25.68"; try { $c = $i + $s1; var_dump($c); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $i + $s2; var_dump($c); @@ -29,8 +29,8 @@ var_dump($c); try { $c = $s1 + $i; var_dump($c); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $s2 + $i; @@ -45,13 +45,13 @@ var_dump($c); echo "Done\n"; ?> --EXPECTF-- -Unsupported operand types: int + string +TypeError: Unsupported operand types: int + string Warning: A non-numeric value encountered in %s on line %d int(951858) int(48550510) float(75661.68) -Unsupported operand types: string + int +TypeError: Unsupported operand types: string + int Warning: A non-numeric value encountered in %s on line %d int(951858) diff --git a/Zend/tests/add_007.phpt b/Zend/tests/add_007.phpt index a2beddfaed41..fb3d5522d5f5 100644 --- a/Zend/tests/add_007.phpt +++ b/Zend/tests/add_007.phpt @@ -9,8 +9,8 @@ $s1 = "some string"; try { var_dump($a + $s1); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = $a + $s1; @@ -19,7 +19,7 @@ var_dump($c); echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: array + string +TypeError: Unsupported operand types: array + string Fatal error: Uncaught TypeError: Unsupported operand types: array + string in %s:%d Stack trace: diff --git a/Zend/tests/arg_unpack/invalid_type.phpt b/Zend/tests/arg_unpack/invalid_type.phpt index a0e649371528..32c624eee2d3 100644 --- a/Zend/tests/arg_unpack/invalid_type.phpt +++ b/Zend/tests/arg_unpack/invalid_type.phpt @@ -9,29 +9,29 @@ function test(...$args) { try { test(...null); -} catch (Error $e) { - echo $e::class . ": " . $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(...42); -} catch (Error $e) { - echo $e::class . ": " . $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(...new stdClass); -} catch (Error $e) { - echo $e::class . ": " . $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(1, 2, 3, ..."foo", ...[4, 5]); -} catch (Error $e) { - echo $e::class . ": " . $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]); -} catch (Error $e) { - echo $e::class . ": " . $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/arg_unpack/non_integer_keys.phpt b/Zend/tests/arg_unpack/non_integer_keys.phpt index 88e1747df9c3..daf7d3c58a76 100644 --- a/Zend/tests/arg_unpack/non_integer_keys.phpt +++ b/Zend/tests/arg_unpack/non_integer_keys.phpt @@ -12,10 +12,10 @@ function gen() { try { foo(...gen()); -} catch (Error $ex) { - echo "Exception: " . $ex->getMessage() . "\n"; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Keys must be of type int|string during argument unpacking +Error: Keys must be of type int|string during argument unpacking diff --git a/Zend/tests/arg_unpack/string_keys.phpt b/Zend/tests/arg_unpack/string_keys.phpt index b0bf366fb38d..3d1d1c866d58 100644 --- a/Zend/tests/arg_unpack/string_keys.phpt +++ b/Zend/tests/arg_unpack/string_keys.phpt @@ -9,10 +9,10 @@ set_error_handler(function($errno, $errstr) { try { var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4])); -} catch (Error $ex) { - var_dump($ex->getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -string(68) "Cannot use positional argument after named argument during unpacking" +Error: Cannot use positional argument after named argument during unpacking diff --git a/Zend/tests/arg_unpack/traversable_throwing_exception.phpt b/Zend/tests/arg_unpack/traversable_throwing_exception.phpt index c78e491e2015..25c5da8df29d 100644 --- a/Zend/tests/arg_unpack/traversable_throwing_exception.phpt +++ b/Zend/tests/arg_unpack/traversable_throwing_exception.phpt @@ -21,13 +21,13 @@ function gen() { try { test(1, 2, ...new Foo, ...[3, 4]); -} catch (Exception $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(1, 2, ...gen(), ...[3, 4]); -} catch (Exception $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(11) "getIterator" -string(3) "gen" +Exception: getIterator +Exception: gen diff --git a/Zend/tests/array_literal_next_element_error.phpt b/Zend/tests/array_literal_next_element_error.phpt index 23dec5e22cae..33ce9e7c35b3 100644 --- a/Zend/tests/array_literal_next_element_error.phpt +++ b/Zend/tests/array_literal_next_element_error.phpt @@ -7,18 +7,18 @@ $i = PHP_INT_MAX; try { $array = [$i => 42, new stdClass]; var_dump($array); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function test($x = [PHP_INT_MAX => 42, "foo"]) {} try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/array_merge_recursive_next_key_overflow.phpt b/Zend/tests/array_merge_recursive_next_key_overflow.phpt index f7d287295783..492d06973b49 100644 --- a/Zend/tests/array_merge_recursive_next_key_overflow.phpt +++ b/Zend/tests/array_merge_recursive_next_key_overflow.phpt @@ -8,7 +8,7 @@ try { ['' => [null]], ); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -17,9 +17,9 @@ try { ['foo' => str_repeat('a', 2)], ); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/array_unpack/already_occupied.phpt b/Zend/tests/array_unpack/already_occupied.phpt index b2febe002156..3f031c082f95 100644 --- a/Zend/tests/array_unpack/already_occupied.phpt +++ b/Zend/tests/array_unpack/already_occupied.phpt @@ -8,26 +8,26 @@ Appending to an array via unpack may fail $arr = [1, 2, 3]; try { var_dump([PHP_INT_MAX-1 => 0, ...$arr]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } const ARR = [1, 2, 3]; function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {} try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/array_unpack/classes.phpt b/Zend/tests/array_unpack/classes.phpt index fa4b0f8e536f..7a1f95552338 100644 --- a/Zend/tests/array_unpack/classes.phpt +++ b/Zend/tests/array_unpack/classes.phpt @@ -19,8 +19,8 @@ var_dump(C::$bar); try { var_dump(D::A); -} catch (Error $ex) { - echo "Exception: " . $ex->getMessage() . "\n"; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- @@ -44,4 +44,4 @@ array(3) { [2]=> int(3) } -Exception: Cannot declare self-referencing constant self::B +Error: Cannot declare self-referencing constant self::B diff --git a/Zend/tests/array_unpack/non_integer_keys.phpt b/Zend/tests/array_unpack/non_integer_keys.phpt index ab7a20ac86b9..099a928ffdd7 100644 --- a/Zend/tests/array_unpack/non_integer_keys.phpt +++ b/Zend/tests/array_unpack/non_integer_keys.phpt @@ -9,10 +9,10 @@ function gen() { try { [...gen()]; -} catch (Error $ex) { - echo "Exception: " . $ex->getMessage() . "\n"; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking diff --git a/Zend/tests/arrow_functions/006.phpt b/Zend/tests/arrow_functions/006.phpt index 6f61b3c817d9..15e1d18d7e0f 100644 --- a/Zend/tests/arrow_functions/006.phpt +++ b/Zend/tests/arrow_functions/006.phpt @@ -16,23 +16,23 @@ $int_fn = fn(int $x): int => $x; var_dump($int_fn($var)); try { $int_fn("foo"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $varargs = fn(?int... $args): array => $args; var_dump($varargs(20, null, 30)); try { $varargs(40, "foo"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- int(2) int(10) -{closure:%s:%d}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d array(3) { [0]=> int(20) @@ -41,4 +41,4 @@ array(3) { [2]=> int(30) } -{closure:%s:%d}(): Argument #2 must be of type ?int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #2 must be of type ?int, string given, called in %s on line %d diff --git a/Zend/tests/arrow_functions/007.phpt b/Zend/tests/arrow_functions/007.phpt index 66b03b84c2e9..7b63b1ba1520 100644 --- a/Zend/tests/arrow_functions/007.phpt +++ b/Zend/tests/arrow_functions/007.phpt @@ -7,17 +7,17 @@ zend.assertions=1 try { assert((fn() => false)()); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert((fn&(int... $args): ?bool => $args[0])(false)); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(): assert((fn() => false)()) failed -assert(): assert((fn&(int ...$args): ?bool => $args[0])(false)) failed +AssertionError: assert((fn() => false)()) +AssertionError: assert((fn&(int ...$args): ?bool => $args[0])(false)) diff --git a/Zend/tests/arrow_functions/gh7900.phpt b/Zend/tests/arrow_functions/gh7900.phpt index d6465c312399..cfe09ba6cc4c 100644 --- a/Zend/tests/arrow_functions/gh7900.phpt +++ b/Zend/tests/arrow_functions/gh7900.phpt @@ -10,17 +10,17 @@ $x = fn(): never => throw new \Exception('Here'); try { var_dump($x()); -} catch (\Exception $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert((fn(): never => 42) && false); -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Here -assert((fn(): never => 42) && false) +Exception: Here +AssertionError: assert((fn(): never => 42) && false) diff --git a/Zend/tests/assert/bug70528.phpt b/Zend/tests/assert/bug70528.phpt index 717c096fdaa3..57aa6706de16 100644 --- a/Zend/tests/assert/bug70528.phpt +++ b/Zend/tests/assert/bug70528.phpt @@ -11,21 +11,21 @@ class Bar {} $bar = "Bar"; try { assert(new \stdClass instanceof $bar); -} catch (\AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(new \stdClass instanceof Bar); -} catch (\AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(new \stdClass instanceof \Foo\Bar); -} catch (\AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(): assert(new \stdClass() instanceof $bar) failed -assert(): assert(new \stdClass() instanceof Bar) failed -assert(): assert(new \stdClass() instanceof \Foo\Bar) failed +AssertionError: assert(new \stdClass() instanceof $bar) +AssertionError: assert(new \stdClass() instanceof Bar) +AssertionError: assert(new \stdClass() instanceof \Foo\Bar) diff --git a/Zend/tests/assert/bug71922.phpt b/Zend/tests/assert/bug71922.phpt index 986254cab732..e996b97dba41 100644 --- a/Zend/tests/assert/bug71922.phpt +++ b/Zend/tests/assert/bug71922.phpt @@ -10,12 +10,12 @@ try { assert(0 && new class { } && new class(42) extends stdclass { }); -} catch (AssertionError $e) { - echo "Assertion failure: ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Assertion failure: assert(0 && new class { +AssertionError: assert(0 && new class { } && new class(42) extends stdclass { }) diff --git a/Zend/tests/assert/expect_003.phpt b/Zend/tests/assert/expect_003.phpt index 350fca6e57b0..6701718daa8e 100644 --- a/Zend/tests/assert/expect_003.phpt +++ b/Zend/tests/assert/expect_003.phpt @@ -7,9 +7,9 @@ assert.exception=1 getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -string(13) "assert(false)" +AssertionError: assert(false) diff --git a/Zend/tests/assert/expect_004.phpt b/Zend/tests/assert/expect_004.phpt index 111e37295fe9..c89741d5b3d1 100644 --- a/Zend/tests/assert/expect_004.phpt +++ b/Zend/tests/assert/expect_004.phpt @@ -7,9 +7,9 @@ assert.exception=1 getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -string(25) "I require this to succeed" +AssertionError: I require this to succeed diff --git a/Zend/tests/assert/expect_005.phpt b/Zend/tests/assert/expect_005.phpt index f2c91f25666e..07747665c569 100644 --- a/Zend/tests/assert/expect_005.phpt +++ b/Zend/tests/assert/expect_005.phpt @@ -8,8 +8,8 @@ assert.exception=1 try { /* by passing we test there are no leaks upon success */ assert(true, "I require this to succeed"); -} catch (AssertionError $ex) { - var_dump($ex->getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } var_dump(true); ?> diff --git a/Zend/tests/assert/expect_015.phpt b/Zend/tests/assert/expect_015.phpt index 3bb08504f581..5834b99d9dad 100644 --- a/Zend/tests/assert/expect_015.phpt +++ b/Zend/tests/assert/expect_015.phpt @@ -19,8 +19,8 @@ assert(0 && ($a = function () { yield 1 => 2; yield from $x; })); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -68,8 +68,8 @@ assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X { } } })); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -104,8 +104,8 @@ L0: } } })); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -120,8 +120,8 @@ assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X { use T3; } })); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -137,8 +137,8 @@ assert(0 && ($a = function &(array &...$a) { echo 3; } })); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -165,13 +165,13 @@ assert(0 && ($a = function (): ?static { } if ($a); else; })); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(0 && ($a = function () { +AssertionError: assert(0 && ($a = function () { global $a; global $$b; static $c; @@ -187,7 +187,7 @@ assert(0 && ($a = function () { yield 1 => 2; yield from $x; })) -assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X { +AssertionError: assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X { abstract class A extends B implements C, D { public const X = 12; public const Y = self::X, Z = 'aaa'; @@ -231,7 +231,7 @@ assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X { } })) -assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X { +AssertionError: assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X { final class A { protected final function f2() { if (!$x) { @@ -270,7 +270,7 @@ assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): } })) -assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X { +AssertionError: assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X { class A { use T1, T2 { T1::foo insteadof foo; @@ -282,7 +282,7 @@ assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X { } })) -assert(0 && ($a = function &(array &...$a) { +AssertionError: assert(0 && ($a = function &(array &...$a) { declare(A = 1, B = 2); try { $i++; @@ -294,7 +294,7 @@ assert(0 && ($a = function &(array &...$a) { echo 3; } })) -assert(0 && ($a = function (): ?static { +AssertionError: assert(0 && ($a = function (): ?static { declare(C = 1) { echo 1; } diff --git a/Zend/tests/assert/expect_016.phpt b/Zend/tests/assert/expect_016.phpt index 32e8fea91715..ad738aef482f 100644 --- a/Zend/tests/assert/expect_016.phpt +++ b/Zend/tests/assert/expect_016.phpt @@ -10,8 +10,8 @@ var_dump(assert(true)); ini_set("zend.assertions", 1); try { var_dump(assert(false)); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(assert(true)); ini_set("zend.assertions", -1); @@ -19,7 +19,7 @@ ini_set("zend.assertions", -1); --EXPECTF-- bool(true) bool(true) -assert(): assert(false) failed +AssertionError: assert(false) bool(true) Warning: zend.assertions may be completely enabled or disabled only in php.ini in %s on line %d diff --git a/Zend/tests/assert/expect_018.phpt b/Zend/tests/assert/expect_018.phpt index abe74ce25225..7a927d0a65e3 100644 --- a/Zend/tests/assert/expect_018.phpt +++ b/Zend/tests/assert/expect_018.phpt @@ -14,14 +14,14 @@ var_dump(assert(true)); ini_set("zend.assertions", 1); try { var_dump(\assert(false)); -} catch (\AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(\assert(true)); try { var_dump(assert(false)); -} catch (\AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(assert(true)); ?> @@ -30,7 +30,7 @@ bool(true) bool(true) bool(true) bool(true) -assert(): assert(false) failed +AssertionError: assert(false) bool(true) -assert(): assert(false) failed +AssertionError: assert(false) bool(true) diff --git a/Zend/tests/assign_dim_obj_null_return.phpt b/Zend/tests/assign_dim_obj_null_return.phpt index e2b7f20a0c07..0ee2a93a8b7b 100644 --- a/Zend/tests/assign_dim_obj_null_return.phpt +++ b/Zend/tests/assign_dim_obj_null_return.phpt @@ -9,61 +9,61 @@ function test() { try { var_dump($array[] = 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($array[[]] = 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($array[new stdClass] = 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($true[123] = 456); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($array[] += 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($array[[]] += 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($array[new stdClass] += 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($true[123] += 456); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($true->foo = 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($true->foo += 123); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -71,13 +71,13 @@ test(); ?> --EXPECT-- -Cannot add element to the array as the next element is already occupied -Cannot access offset of type array on array -Cannot access offset of type stdClass on array -Cannot use a scalar value as an array -Cannot add element to the array as the next element is already occupied -Cannot access offset of type array on array -Cannot access offset of type stdClass on array -Cannot use a scalar value as an array -Attempt to assign property "foo" on true -Attempt to assign property "foo" on true +Error: Cannot add element to the array as the next element is already occupied +TypeError: Cannot access offset of type array on array +TypeError: Cannot access offset of type stdClass on array +Error: Cannot use a scalar value as an array +Error: Cannot add element to the array as the next element is already occupied +TypeError: Cannot access offset of type array on array +TypeError: Cannot access offset of type stdClass on array +Error: Cannot use a scalar value as an array +Error: Attempt to assign property "foo" on true +Error: Attempt to assign property "foo" on true diff --git a/Zend/tests/assign_op_type_error.phpt b/Zend/tests/assign_op_type_error.phpt index 5f175613e20b..3068e0ca48be 100644 --- a/Zend/tests/assign_op_type_error.phpt +++ b/Zend/tests/assign_op_type_error.phpt @@ -6,52 +6,52 @@ TypeError for compound assignment operations $x = []; try { $x += "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x -= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x *= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x /= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x **= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x %= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x <<= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x >>= "1"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: array + string -Unsupported operand types: array - string -Unsupported operand types: array * string -Unsupported operand types: array / string -Unsupported operand types: array ** string -Unsupported operand types: array % string -Unsupported operand types: array << string -Unsupported operand types: array >> string +TypeError: Unsupported operand types: array + string +TypeError: Unsupported operand types: array - string +TypeError: Unsupported operand types: array * string +TypeError: Unsupported operand types: array / string +TypeError: Unsupported operand types: array ** string +TypeError: Unsupported operand types: array % string +TypeError: Unsupported operand types: array << string +TypeError: Unsupported operand types: array >> string diff --git a/Zend/tests/assign_property_null_object.phpt b/Zend/tests/assign_property_null_object.phpt index fff2c99f6201..622746ba0ee9 100644 --- a/Zend/tests/assign_property_null_object.phpt +++ b/Zend/tests/assign_property_null_object.phpt @@ -15,8 +15,8 @@ print "ok\n"; try { $test->a()->a = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } print "ok\n"; @@ -24,5 +24,5 @@ print "ok\n"; --EXPECTF-- Warning: Attempt to read property "a" on null in %s on line %d ok -Attempt to assign property "a" on null +Error: Attempt to assign property "a" on null ok diff --git a/Zend/tests/assign_ref_error_var_handling.phpt b/Zend/tests/assign_ref_error_var_handling.phpt index 2a66b68cc549..3fbbcefe337a 100644 --- a/Zend/tests/assign_ref_error_var_handling.phpt +++ b/Zend/tests/assign_ref_error_var_handling.phpt @@ -11,20 +11,20 @@ $var = 24; $arr = [PHP_INT_MAX => "foo"]; try { var_dump($arr[] =& $var); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(count($arr)); try { var_dump($arr[] =& val()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(count($arr)); ?> --EXPECT-- -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 int(1) -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 int(1) diff --git a/Zend/tests/assign_to_obj_002.phpt b/Zend/tests/assign_to_obj_002.phpt index a911c06f36d5..52541e28e06f 100644 --- a/Zend/tests/assign_to_obj_002.phpt +++ b/Zend/tests/assign_to_obj_002.phpt @@ -5,8 +5,8 @@ Assign to $this leaks when $this not defined try { $this->a = new stdClass; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Using $this when not in object context +Error: Using $this when not in object context diff --git a/Zend/tests/ast/ast_serialize_backtick_literal.phpt b/Zend/tests/ast/ast_serialize_backtick_literal.phpt index 46aa0ebe8ae2..85e5dd6fbb66 100644 --- a/Zend/tests/ast/ast_serialize_backtick_literal.phpt +++ b/Zend/tests/ast/ast_serialize_backtick_literal.phpt @@ -7,10 +7,10 @@ zend.assertions=1 try { assert(false && `echo -n ""`); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(): assert(false && `echo -n ""`) failed +AssertionError: assert(false && `echo -n ""`) diff --git a/Zend/tests/ast/ast_serialize_floats.phpt b/Zend/tests/ast/ast_serialize_floats.phpt index 164b8b03338c..73426b0ded3b 100644 --- a/Zend/tests/ast/ast_serialize_floats.phpt +++ b/Zend/tests/ast/ast_serialize_floats.phpt @@ -6,21 +6,21 @@ zend.assertions=1 getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(!is_float(1.1)); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(!is_float(1234.5678)); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(): assert(!is_float(0.0)) failed -assert(): assert(!is_float(1.1)) failed -assert(): assert(!is_float(1234.5678)) failed +AssertionError: assert(!is_float(0.0)) +AssertionError: assert(!is_float(1.1)) +AssertionError: assert(!is_float(1234.5678)) diff --git a/Zend/tests/ast/gh21072.phpt b/Zend/tests/ast/gh21072.phpt index 1ffd0518eaea..88b9d0e00304 100644 --- a/Zend/tests/ast/gh21072.phpt +++ b/Zend/tests/ast/gh21072.phpt @@ -9,8 +9,8 @@ try { public $p = (unset) C::class; } new C; -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- diff --git a/Zend/tests/ast/zend-pow-assign.phpt b/Zend/tests/ast/zend-pow-assign.phpt index fd8bf8346cec..98ad319fc7a2 100644 --- a/Zend/tests/ast/zend-pow-assign.phpt +++ b/Zend/tests/ast/zend-pow-assign.phpt @@ -7,9 +7,9 @@ zend.assertions=1 try { assert(false && ($a **= 2)); -} catch (AssertionError $e) { - echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(): assert(false && ($a **= 2)) failed +AssertionError: assert(false && ($a **= 2)) diff --git a/Zend/tests/asymmetric_visibility/__set.phpt b/Zend/tests/asymmetric_visibility/__set.phpt index 7476f5304e25..17c6aaef1bd2 100644 --- a/Zend/tests/asymmetric_visibility/__set.phpt +++ b/Zend/tests/asymmetric_visibility/__set.phpt @@ -22,15 +22,15 @@ class Foo { $foo = new Foo(); try { $foo->bar = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setBar('baz'); try { $foo->bar = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->unsetBar(); @@ -38,6 +38,6 @@ $foo->bar = 'baz'; ?> --EXPECT-- -Cannot modify private(set) property Foo::$bar from global scope -Cannot modify private(set) property Foo::$bar from global scope +Error: Cannot modify private(set) property Foo::$bar from global scope +Error: Cannot modify private(set) property Foo::$bar from global scope Foo::Foo::__set diff --git a/Zend/tests/asymmetric_visibility/__unset.phpt b/Zend/tests/asymmetric_visibility/__unset.phpt index 3d5977d79782..ca065080bf98 100644 --- a/Zend/tests/asymmetric_visibility/__unset.phpt +++ b/Zend/tests/asymmetric_visibility/__unset.phpt @@ -22,8 +22,8 @@ class Foo { function test($foo) { try { unset($foo->bar); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -41,7 +41,7 @@ test($foo); ?> --EXPECT-- -Cannot unset private(set) property Foo::$bar from global scope +Error: Cannot unset private(set) property Foo::$bar from global scope Foo::__unset -Cannot unset private(set) property Foo::$bar from global scope +Error: Cannot unset private(set) property Foo::$bar from global scope Foo::__unset diff --git a/Zend/tests/asymmetric_visibility/ast_printing.phpt b/Zend/tests/asymmetric_visibility/ast_printing.phpt index 25803e67c09d..aabf2a3df2c2 100644 --- a/Zend/tests/asymmetric_visibility/ast_printing.phpt +++ b/Zend/tests/asymmetric_visibility/ast_printing.phpt @@ -13,13 +13,13 @@ try { public protected(set) string $baz; } } && false); -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(function () { +AssertionError: assert(function () { class Foo { public private(set) string $bar; public protected(set) string $baz; diff --git a/Zend/tests/asymmetric_visibility/bug001.phpt b/Zend/tests/asymmetric_visibility/bug001.phpt index c306434d610b..28c4e9c8c626 100644 --- a/Zend/tests/asymmetric_visibility/bug001.phpt +++ b/Zend/tests/asymmetric_visibility/bug001.phpt @@ -19,14 +19,14 @@ class D extends C { $c = new D(); try { unset($c->a); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($c); ?> --EXPECTF-- -Cannot unset private(set) property C::$a from scope D +Error: Cannot unset private(set) property C::$a from scope D object(D)#%d (0) { ["a"]=> uninitialized(int) diff --git a/Zend/tests/asymmetric_visibility/bug002.phpt b/Zend/tests/asymmetric_visibility/bug002.phpt index 1f6dc2b85278..bca8864f29f1 100644 --- a/Zend/tests/asymmetric_visibility/bug002.phpt +++ b/Zend/tests/asymmetric_visibility/bug002.phpt @@ -19,14 +19,14 @@ class D extends C { $c = new D(); try { $c->a = 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($c); ?> --EXPECTF-- -Cannot modify private(set) property C::$a from scope D +Error: Cannot modify private(set) property C::$a from scope D object(D)#%d (0) { ["a"]=> uninitialized(int) diff --git a/Zend/tests/asymmetric_visibility/bug003.phpt b/Zend/tests/asymmetric_visibility/bug003.phpt index 9f541f87f7cd..af840222be71 100644 --- a/Zend/tests/asymmetric_visibility/bug003.phpt +++ b/Zend/tests/asymmetric_visibility/bug003.phpt @@ -13,16 +13,16 @@ class C { $c = new C(); try { $c->a = 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($c->a); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify private(set) property C::$a from global scope -Cannot unset private(set) property C::$a from global scope +Error: Cannot modify private(set) property C::$a from global scope +Error: Cannot unset private(set) property C::$a from global scope diff --git a/Zend/tests/asymmetric_visibility/cpp_private.phpt b/Zend/tests/asymmetric_visibility/cpp_private.phpt index c308330d3ab0..4430f88f4f92 100644 --- a/Zend/tests/asymmetric_visibility/cpp_private.phpt +++ b/Zend/tests/asymmetric_visibility/cpp_private.phpt @@ -18,8 +18,8 @@ var_dump($foo->bar); try { $foo->bar = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setBar('baz'); @@ -28,5 +28,5 @@ var_dump($foo->bar); ?> --EXPECT-- string(3) "bar" -Cannot modify private(set) property Foo::$bar from global scope +Error: Cannot modify private(set) property Foo::$bar from global scope string(3) "baz" diff --git a/Zend/tests/asymmetric_visibility/cpp_protected.phpt b/Zend/tests/asymmetric_visibility/cpp_protected.phpt index f13351e32003..5cb6be2c99ac 100644 --- a/Zend/tests/asymmetric_visibility/cpp_protected.phpt +++ b/Zend/tests/asymmetric_visibility/cpp_protected.phpt @@ -24,8 +24,8 @@ var_dump($foo->bar); try { $foo->bar = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setBarPrivate('baz'); @@ -37,6 +37,6 @@ var_dump($foo->bar); ?> --EXPECT-- string(3) "bar" -Cannot modify protected(set) property Foo::$bar from global scope +Error: Cannot modify protected(set) property Foo::$bar from global scope string(3) "baz" string(3) "qux" diff --git a/Zend/tests/asymmetric_visibility/dim_add.phpt b/Zend/tests/asymmetric_visibility/dim_add.phpt index f7bf0ceaf939..9038f1d3186d 100644 --- a/Zend/tests/asymmetric_visibility/dim_add.phpt +++ b/Zend/tests/asymmetric_visibility/dim_add.phpt @@ -15,8 +15,8 @@ $foo = new Foo(); try { $foo->bars[] = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo->bars); @@ -25,7 +25,7 @@ var_dump($foo->bars); ?> --EXPECT-- -Cannot indirectly modify private(set) property Foo::$bars from global scope +Error: Cannot indirectly modify private(set) property Foo::$bars from global scope array(0) { } array(1) { diff --git a/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt b/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt index 2e24ad1f8d03..96c08c840dc8 100644 --- a/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt +++ b/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt @@ -14,8 +14,8 @@ class C extends P { var_dump($this->prop); try { $this->prop = 'overwritten'; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($this->prop); } @@ -27,8 +27,8 @@ $c->test(); ?> --EXPECT-- string(7) "default" -Cannot modify private(set) property P::$prop from scope C +Error: Cannot modify private(set) property P::$prop from scope C string(7) "default" string(7) "default" -Cannot modify private(set) property P::$prop from scope C +Error: Cannot modify private(set) property P::$prop from scope C string(7) "default" diff --git a/Zend/tests/asymmetric_visibility/private.phpt b/Zend/tests/asymmetric_visibility/private.phpt index 48e557c6e87d..bcdb33b39ffd 100644 --- a/Zend/tests/asymmetric_visibility/private.phpt +++ b/Zend/tests/asymmetric_visibility/private.phpt @@ -28,8 +28,8 @@ var_dump($foo->bar); try { $foo->bar = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setBar('baz'); @@ -37,8 +37,8 @@ var_dump($foo->bar); try { $foo->baz = 'baz2'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setBaz('baz2'); @@ -47,15 +47,15 @@ var_dump($foo->baz); $child = new FooChild(); try { $child->modifyBar('baz'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(3) "bar" -Cannot modify private(set) property Foo::$bar from global scope +Error: Cannot modify private(set) property Foo::$bar from global scope string(3) "baz" -Cannot modify private(set) property Foo::$baz from global scope +Error: Cannot modify private(set) property Foo::$baz from global scope string(4) "baz2" -Cannot modify private(set) property Foo::$bar from scope FooChild +Error: Cannot modify private(set) property Foo::$bar from scope FooChild diff --git a/Zend/tests/asymmetric_visibility/protected.phpt b/Zend/tests/asymmetric_visibility/protected.phpt index 49a39b399362..9c79752c23c7 100644 --- a/Zend/tests/asymmetric_visibility/protected.phpt +++ b/Zend/tests/asymmetric_visibility/protected.phpt @@ -32,8 +32,8 @@ var_dump($foo->bar); try { $foo->bar = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setBarPrivate('baz'); @@ -44,8 +44,8 @@ var_dump($foo->bar); try { $foo->baz = 'baz'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->setbazPrivate('baz2'); @@ -58,9 +58,9 @@ var_dump($foo->baz); ?> --EXPECT-- string(3) "bar" -Cannot modify protected(set) property Foo::$bar from global scope +Error: Cannot modify protected(set) property Foo::$bar from global scope string(3) "baz" string(3) "qux" -Cannot modify protected(set) property Foo::$baz from global scope +Error: Cannot modify protected(set) property Foo::$baz from global scope string(4) "baz2" string(4) "baz3" diff --git a/Zend/tests/asymmetric_visibility/readonly.phpt b/Zend/tests/asymmetric_visibility/readonly.phpt index e02d36907998..d8ae18bb1bea 100644 --- a/Zend/tests/asymmetric_visibility/readonly.phpt +++ b/Zend/tests/asymmetric_visibility/readonly.phpt @@ -22,8 +22,8 @@ class C extends P { $this->pDefault = 1; try { $this->pPrivate = 1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $this->pProtected = 1; $this->pPublic = 1; @@ -34,18 +34,18 @@ function test() { $p = new ReflectionClass(P::class)->newInstanceWithoutConstructor(); try { $p->pDefault = 1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p->pPrivate = 1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $p->pProtected = 1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $p->pPublic = 1; } @@ -56,7 +56,7 @@ test(); ?> --EXPECT-- -Cannot modify private(set) property P::$pPrivate from scope C -Cannot modify protected(set) readonly property P::$pDefault from global scope -Cannot modify private(set) property P::$pPrivate from global scope -Cannot modify protected(set) readonly property P::$pProtected from global scope +Error: Cannot modify private(set) property P::$pPrivate from scope C +Error: Cannot modify protected(set) readonly property P::$pDefault from global scope +Error: Cannot modify private(set) property P::$pPrivate from global scope +Error: Cannot modify protected(set) readonly property P::$pProtected from global scope diff --git a/Zend/tests/asymmetric_visibility/reference.phpt b/Zend/tests/asymmetric_visibility/reference.phpt index ae5271418282..34c0324b988e 100644 --- a/Zend/tests/asymmetric_visibility/reference.phpt +++ b/Zend/tests/asymmetric_visibility/reference.phpt @@ -17,8 +17,8 @@ $foo = new Foo(); try { $bar = &$foo->bar; $bar++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo->bar); @@ -27,6 +27,6 @@ var_dump($foo->bar); ?> --EXPECT-- -Cannot indirectly modify private(set) property Foo::$bar from global scope +Error: Cannot indirectly modify private(set) property Foo::$bar from global scope int(0) int(1) diff --git a/Zend/tests/asymmetric_visibility/reference_2.phpt b/Zend/tests/asymmetric_visibility/reference_2.phpt index d4ef6c03a788..ba5c0e5ac2be 100644 --- a/Zend/tests/asymmetric_visibility/reference_2.phpt +++ b/Zend/tests/asymmetric_visibility/reference_2.phpt @@ -14,17 +14,17 @@ function test($c) { try { test(new C()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(new C()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot indirectly modify private(set) property C::$prop from global scope -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope diff --git a/Zend/tests/asymmetric_visibility/scope_rebinding.phpt b/Zend/tests/asymmetric_visibility/scope_rebinding.phpt index 8c10d10f77a4..4351e8796e5d 100644 --- a/Zend/tests/asymmetric_visibility/scope_rebinding.phpt +++ b/Zend/tests/asymmetric_visibility/scope_rebinding.phpt @@ -18,19 +18,19 @@ $c = function () use ($foo) { var_dump($foo->bar); try { $c(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ($c->bindTo(null, Bar::class))(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo->bar); ?> --EXPECT-- int(2) -Cannot modify private(set) property Foo::$bar from global scope -Cannot modify private(set) property Foo::$bar from scope Bar +Error: Cannot modify private(set) property Foo::$bar from global scope +Error: Cannot modify private(set) property Foo::$bar from scope Bar int(2) diff --git a/Zend/tests/asymmetric_visibility/static_props.phpt b/Zend/tests/asymmetric_visibility/static_props.phpt index f47dcf70b6f7..1bba69bebd4e 100644 --- a/Zend/tests/asymmetric_visibility/static_props.phpt +++ b/Zend/tests/asymmetric_visibility/static_props.phpt @@ -29,8 +29,8 @@ function test() { try { C::$prop = 2; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop); @@ -39,30 +39,30 @@ function test() { try { ++C::$prop; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop); try { C::$prop++; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop); try { C::$prop += str_repeat('a', 10); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop); try { $ref = &C::$prop; $ref++; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop); @@ -70,15 +70,15 @@ function test() { $ref = 4; C::$prop = &$ref; $ref++; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop); try { C::$prop2[] = 'foo'; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(C::$prop2); @@ -97,20 +97,20 @@ test(); ?> --EXPECTF-- -Cannot modify private(set) property C::$prop from global scope +Error: Cannot modify private(set) property C::$prop from global scope int(1) int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop2 from global scope +Error: Cannot indirectly modify private(set) property C::$prop2 from global scope array(0) { } array(1) { @@ -123,20 +123,20 @@ object(stdClass)#%d (1) { } Repeat: -Cannot modify private(set) property C::$prop from global scope +Error: Cannot modify private(set) property C::$prop from global scope int(1) int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop from global scope +Error: Cannot indirectly modify private(set) property C::$prop from global scope int(3) -Cannot indirectly modify private(set) property C::$prop2 from global scope +Error: Cannot indirectly modify private(set) property C::$prop2 from global scope array(0) { } array(1) { diff --git a/Zend/tests/asymmetric_visibility/unset.phpt b/Zend/tests/asymmetric_visibility/unset.phpt index 3fd3d7673081..039bdb84bb40 100644 --- a/Zend/tests/asymmetric_visibility/unset.phpt +++ b/Zend/tests/asymmetric_visibility/unset.phpt @@ -36,8 +36,8 @@ $foo = new FooChild(); $foo->setBar('bar'); try { unset($foo->bar); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo->bar ?? 'unset'); @@ -52,16 +52,16 @@ var_dump($foo->bar ?? 'unset'); $foo->setSecret('beep'); try { $foo->unsetSecret(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo->secret ?? 'unset'); ?> --EXPECT-- -Cannot unset protected(set) property Foo::$bar from global scope +Error: Cannot unset protected(set) property Foo::$bar from global scope string(3) "bar" string(5) "unset" string(5) "unset" -Cannot unset private(set) property Foo::$secret from scope FooChild +Error: Cannot unset private(set) property Foo::$secret from scope FooChild string(4) "beep" diff --git a/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt b/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt index d81f4d3891bf..9c57c85a30a9 100644 --- a/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt +++ b/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt @@ -17,20 +17,20 @@ class C extends P { $c = new C(); try { $c->setBar(1); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $c->setBar(1); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($c); ?> --EXPECTF-- -Typed property P::$bar must not be accessed before initialization -Typed property P::$bar must not be accessed before initialization +Error: Typed property P::$bar must not be accessed before initialization +Error: Typed property P::$bar must not be accessed before initialization object(C)#%d (0) { ["bar"]=> uninitialized(string) diff --git a/Zend/tests/attributes/003_ast_nodes.phpt b/Zend/tests/attributes/003_ast_nodes.phpt index 854edf3d63c1..2d47a89e78b4 100644 --- a/Zend/tests/attributes/003_ast_nodes.phpt +++ b/Zend/tests/attributes/003_ast_nodes.phpt @@ -71,14 +71,14 @@ var_dump(count($attr)); try { $attr[0]->getArguments(); -} catch (\Error $e) { - var_dump($e->getMessage()); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $attr[0]->newInstance(); -} catch (\Error $e) { - var_dump($e->getMessage()); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -104,5 +104,5 @@ array(1) { } int(1) -string(30) "Class "MissingClass" not found" -string(30) "Class "MissingClass" not found" +Error: Class "MissingClass" not found +Error: Class "MissingClass" not found diff --git a/Zend/tests/attributes/005_objects.phpt b/Zend/tests/attributes/005_objects.phpt index 2b08db838b27..4e0bd69ce3c2 100644 --- a/Zend/tests/attributes/005_objects.phpt +++ b/Zend/tests/attributes/005_objects.phpt @@ -30,8 +30,8 @@ $ref = new \ReflectionFunction(#[A1] function () { }); try { $ref->getAttributes()[0]->newInstance(); -} catch (\ArgumentCountError $e) { - var_dump('ERROR 1', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -40,8 +40,8 @@ $ref = new \ReflectionFunction(#[A1([])] function () { }); try { $ref->getAttributes()[0]->newInstance(); -} catch (\TypeError $e) { - var_dump('ERROR 2', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 2: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -50,8 +50,8 @@ $ref = new \ReflectionFunction(#[A2] function () { }); try { $ref->getAttributes()[0]->newInstance(); -} catch (\Error $e) { - var_dump('ERROR 3', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 3: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -66,8 +66,8 @@ $ref = new \ReflectionFunction(#[A3] function () { }); try { $ref->getAttributes()[0]->newInstance(); -} catch (\Error $e) { - var_dump('ERROR 4', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 4: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -78,8 +78,8 @@ $ref = new \ReflectionFunction(#[A5] function () { }); try { $ref->getAttributes()[0]->newInstance(); -} catch (\Error $e) { - var_dump('ERROR 6', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 6: ', $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -88,17 +88,12 @@ string(2) "A1" string(4) "test" int(50) -string(7) "ERROR 1" -string(%d) "Too few arguments to function A1::__construct(), 0 passed in %s005_objects.php on line 26 and at least 1 expected" +ERROR 1: ArgumentCountError: Too few arguments to function A1::__construct(), 0 passed in %s005_objects.php on line 26 and at least 1 expected -string(7) "ERROR 2" -string(%d) "A1::__construct(): Argument #1 ($name) must be of type string, array given, called in %s005_objects.php on line 36" +ERROR 2: TypeError: A1::__construct(): Argument #1 ($name) must be of type string, array given, called in %s005_objects.php on line 36 -string(7) "ERROR 3" -string(30) "Attribute class "A2" not found" +ERROR 3: Error: Attribute class "A2" not found -string(7) "ERROR 4" -string(51) "Call to private A3::__construct() from global scope" +ERROR 4: Error: Call to private A3::__construct() from global scope -string(7) "ERROR 6" -string(55) "Attempting to use non-attribute class "A5" as attribute" +ERROR 6: Error: Attempting to use non-attribute class "A5" as attribute diff --git a/Zend/tests/attributes/006_filter.phpt b/Zend/tests/attributes/006_filter.phpt index 2924e6ed7982..badbe9f9a5b3 100644 --- a/Zend/tests/attributes/006_filter.phpt +++ b/Zend/tests/attributes/006_filter.phpt @@ -56,16 +56,16 @@ $ref = new \ReflectionFunction(function () { }); try { $ref->getAttributes(A1::class, 3); -} catch (\Error $e) { - var_dump('ERROR 1', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n"; } $ref = new \ReflectionFunction(function () { }); try { $ref->getAttributes(SomeMissingClass::class, \ReflectionAttribute::IS_INSTANCEOF); -} catch (\Error $e) { - var_dump('ERROR 2', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 2: ', $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -106,7 +106,5 @@ Array [2] => A3 ) -string(7) "ERROR 1" -string(103) "ReflectionFunctionAbstract::getAttributes(): Argument #2 ($flags) must be a valid attribute filter flag" -string(7) "ERROR 2" -string(34) "Class "SomeMissingClass" not found" +ERROR 1: ValueError: ReflectionFunctionAbstract::getAttributes(): Argument #2 ($flags) must be a valid attribute filter flag +ERROR 2: Error: Class "SomeMissingClass" not found diff --git a/Zend/tests/attributes/013_class_scope.phpt b/Zend/tests/attributes/013_class_scope.phpt index ff16bb7b8225..d3991ad9f1c8 100644 --- a/Zend/tests/attributes/013_class_scope.phpt +++ b/Zend/tests/attributes/013_class_scope.phpt @@ -46,8 +46,8 @@ $attr = $ref->getMethod('foo')->getAttributes()[0]; try { $attr->getArguments(); -} catch (\Error $e) { - var_dump('ERROR 1', $e->getMessage()); +} catch (\Throwable $e) { + echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -108,8 +108,7 @@ Array [0] => C2 [1] => bar ) -string(7) "ERROR 1" -string(28) "Undefined constant self::FOO" +ERROR 1: Error: Undefined constant self::FOO bool(true) string(3) "bar" diff --git a/Zend/tests/attributes/020_userland_attribute_validation.phpt b/Zend/tests/attributes/020_userland_attribute_validation.phpt index ce2acb26db16..008a892c707c 100644 --- a/Zend/tests/attributes/020_userland_attribute_validation.phpt +++ b/Zend/tests/attributes/020_userland_attribute_validation.phpt @@ -20,7 +20,7 @@ var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_CLASS, $attr- try { $attr->newInstance(); } catch (\Throwable $e) { - var_dump('ERROR 1', $e->getMessage()); + echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -32,7 +32,7 @@ var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_FUNCTION, $at try { $attr->newInstance(); } catch (\Throwable $e) { - var_dump('ERROR 2', $e->getMessage()); + echo 'ERROR 2: ', $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -55,14 +55,12 @@ string(2) "A1" string(2) "A1" bool(true) bool(false) -string(7) "ERROR 1" -string(70) "Attribute "A1" cannot target class (allowed targets: function, method)" +ERROR 1: Error: Attribute "A1" cannot target class (allowed targets: function, method) string(2) "A1" bool(true) bool(true) -string(7) "ERROR 2" -string(35) "Attribute "A1" must not be repeated" +ERROR 2: Error: Attribute "A1" must not be repeated string(2) "A2" bool(true) diff --git a/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt b/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt index 70e4fdb7f338..fbcb598d135a 100644 --- a/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt +++ b/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt @@ -11,10 +11,10 @@ class Foo {} try { (new ReflectionClass(Foo::class))->getAttributes()[0]->newInstance(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attribute::__construct(): Argument #1 ($flags) must be of type int, string given +Error: Attribute::__construct(): Argument #1 ($flags) must be of type int, string given diff --git a/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt b/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt index efaa969af827..d06b92aad79c 100644 --- a/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt +++ b/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt @@ -11,10 +11,10 @@ class Foo { } try { var_dump((new ReflectionClass(Foo::class))->getAttributes()[0]->newInstance()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid attribute flags specified +Error: Invalid attribute flags specified diff --git a/Zend/tests/attributes/023_ast_node_in_validation.phpt b/Zend/tests/attributes/023_ast_node_in_validation.phpt index 063a6b7e815d..10b2101d1747 100644 --- a/Zend/tests/attributes/023_ast_node_in_validation.phpt +++ b/Zend/tests/attributes/023_ast_node_in_validation.phpt @@ -11,10 +11,10 @@ class Bar { } try { var_dump((new ReflectionClass(Bar::class))->getAttributes()[0]->newInstance()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Class "Foo" not found +Error: Class "Foo" not found diff --git a/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt b/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt index b1efb538b328..43ff78e0720d 100644 --- a/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt +++ b/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt @@ -65,8 +65,8 @@ foreach ($cases as $r) { var_dump($attributes); try { $attributes[1]->newInstance(); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt b/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt index 68d1ae43bd46..7fd5ef63b404 100644 --- a/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt +++ b/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt @@ -19,8 +19,8 @@ $attributes = $r->getAttributes(); var_dump($attributes); try { $attributes[1]->newInstance(); -} catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt b/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt index 63add9e445a9..57063a55fbaa 100644 --- a/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt +++ b/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt @@ -32,8 +32,8 @@ foreach ($cases as $r) { var_dump($attributes); try { $attributes[1]->newInstance(); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt b/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt index 0571024f19ce..ad618c84aca7 100644 --- a/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt +++ b/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt @@ -32,8 +32,8 @@ foreach ($cases as $r) { var_dump($attributes); try { $attributes[1]->newInstance(); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt b/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt index f5fedb4ee68e..8e0e6f4fbf35 100644 --- a/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt +++ b/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt @@ -27,8 +27,8 @@ foreach ($cases as $r) { var_dump($attributes); try { $attributes[1]->newInstance(); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt b/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt index e3cfe9d1c109..3009315b6c4e 100644 --- a/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt +++ b/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt @@ -25,8 +25,8 @@ foreach ($cases as $r) { var_dump($attributes); try { $attributes[1]->newInstance(); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt b/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt index ab84d4724226..97fdf986d287 100644 --- a/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt +++ b/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt @@ -20,17 +20,17 @@ class Clazz { try { Clazz::TEST; -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Clazz::TEST3; -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Caught: Constant Clazz::TEST is deprecated, from itself -Caught: Constant Clazz::TEST2 is deprecated +ErrorException: Constant Clazz::TEST is deprecated, from itself +ErrorException: Constant Clazz::TEST2 is deprecated diff --git a/Zend/tests/attributes/deprecated/constants/const_messages.phpt b/Zend/tests/attributes/deprecated/constants/const_messages.phpt index 1cf8b11af156..2ced4e06fd29 100644 --- a/Zend/tests/attributes/deprecated/constants/const_messages.phpt +++ b/Zend/tests/attributes/deprecated/constants/const_messages.phpt @@ -46,4 +46,3 @@ Deprecated: Constant DeprecatedConst5 is deprecated since 1.0, use DEPRECATED_CO Deprecated: Constant DeprecatedConst6 is deprecated since 1.0 in %s on line %d 6 - diff --git a/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt b/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt index f749293d8fac..6d12af0f2419 100644 --- a/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt +++ b/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt @@ -18,17 +18,17 @@ const TEST3 = 1; try { TEST; -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { TEST3; -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Caught: Constant TEST is deprecated, from itself -Caught: Constant TEST2 is deprecated +ErrorException: Constant TEST is deprecated, from itself +ErrorException: Constant TEST2 is deprecated diff --git a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt index af816aea6c4b..e4d1c4807d74 100644 --- a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt +++ b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt @@ -14,8 +14,8 @@ function test() { try { test(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } eval(<<<'CODE' @@ -27,8 +27,8 @@ CODE); try { test2(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Clazz { @@ -41,8 +41,8 @@ class Clazz { try { $cls = new Clazz(); $cls->test(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $closure = #[\Deprecated("convert to exception")] function () { @@ -51,8 +51,8 @@ $closure = #[\Deprecated("convert to exception")] function () { try { $closure(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Constructor { @@ -64,8 +64,8 @@ class Constructor { try { new Constructor(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Destructor { @@ -77,15 +77,15 @@ class Destructor { try { new Destructor(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Caught: Function test() is deprecated, convert to exception -Caught: Function test2() is deprecated, convert to exception -Caught: Method Clazz::test() is deprecated, convert to exception -Caught: Function {closure:%s:%d}() is deprecated, convert to exception -Caught: Method Constructor::__construct() is deprecated, convert to exception -Caught: Method Destructor::__destruct() is deprecated, convert to exception +ErrorException: Function test() is deprecated, convert to exception +ErrorException: Function test2() is deprecated, convert to exception +ErrorException: Method Clazz::test() is deprecated, convert to exception +ErrorException: Function {closure:%s:%d}() is deprecated, convert to exception +ErrorException: Method Constructor::__construct() is deprecated, convert to exception +ErrorException: Method Destructor::__destruct() is deprecated, convert to exception diff --git a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt index 3c9c9ec952fc..0b8395aaae61 100644 --- a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt +++ b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt @@ -12,10 +12,10 @@ function test() {} try { $x = test(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Caught: Function test() is deprecated +ErrorException: Function test() is deprecated diff --git a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt index 734a30795e5b..00efe2b69637 100644 --- a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt +++ b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt @@ -12,10 +12,10 @@ function test($dummy) {} try { $x = test(new stdClass()); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Caught: Function test() is deprecated +ErrorException: Function test() is deprecated diff --git a/Zend/tests/attributes/nodiscard/002.phpt b/Zend/tests/attributes/nodiscard/002.phpt index 618aa2f6286d..c690212a52ad 100644 --- a/Zend/tests/attributes/nodiscard/002.phpt +++ b/Zend/tests/attributes/nodiscard/002.phpt @@ -41,4 +41,3 @@ __callStatic(test) Warning: The return value of method Clazz::__invoke() should either be used or intentionally ignored by casting it as (void) in %s on line %d __invoke(foo) - diff --git a/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt b/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt index 51179b26ab19..0a8d2f8bbe78 100644 --- a/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt +++ b/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt @@ -14,8 +14,8 @@ function test(): int { try { test(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } #[\NoDiscard] @@ -25,11 +25,11 @@ function test2(): stdClass { try { test2(); -} catch (ErrorException $e) { - echo "Caught: ", $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Caught: The return value of function test() should either be used or intentionally ignored by casting it as (void) -Caught: The return value of function test2() should either be used or intentionally ignored by casting it as (void) +ErrorException: The return value of function test() should either be used or intentionally ignored by casting it as (void) +ErrorException: The return value of function test2() should either be used or intentionally ignored by casting it as (void) diff --git a/Zend/tests/attributes/ossfuzz371445205.phpt b/Zend/tests/attributes/ossfuzz371445205.phpt index 17e4f529a2a0..1959affaca6e 100644 --- a/Zend/tests/attributes/ossfuzz371445205.phpt +++ b/Zend/tests/attributes/ossfuzz371445205.phpt @@ -9,9 +9,9 @@ class Test1{} $attr=(new ReflectionClass(Test1::class))->getAttributes()[0]; try { $attr->newInstance(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unknown named parameter $notinterned +Error: Unknown named parameter $notinterned diff --git a/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt b/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt index f6ea383c397e..82f75742c774 100644 --- a/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt +++ b/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt @@ -5,4 +5,3 @@ Calling debug_print_backtrace() from main script debug_print_backtrace(); ?> --EXPECT-- - diff --git a/Zend/tests/bind_static_exception.phpt b/Zend/tests/bind_static_exception.phpt index c374130aaecf..5cf689047601 100644 --- a/Zend/tests/bind_static_exception.phpt +++ b/Zend/tests/bind_static_exception.phpt @@ -10,9 +10,9 @@ class Test { try { $new = new Test; static $new; -} 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/bitwise_not_precision_exception.phpt b/Zend/tests/bitwise_not_precision_exception.phpt index e28bf8f4e17b..c8b0c44c1806 100644 --- a/Zend/tests/bitwise_not_precision_exception.phpt +++ b/Zend/tests/bitwise_not_precision_exception.phpt @@ -7,9 +7,9 @@ set_error_handler(function($_, $msg) { }); try { var_dump(~INF); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -The float INF is not representable as an int, cast occurred +Exception: The float INF is not representable as an int, cast occurred diff --git a/Zend/tests/bug26229.phpt b/Zend/tests/bug26229.phpt index 5914b977ef51..d25fc7fcd5d7 100644 --- a/Zend/tests/bug26229.phpt +++ b/Zend/tests/bug26229.phpt @@ -19,10 +19,10 @@ try var_dump($value); } } -catch(Exception $e) +catch(Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator +Exception: Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt index 862fc6fc46dc..b20d7f10923f 100644 --- a/Zend/tests/bug31098.phpt +++ b/Zend/tests/bug31098.phpt @@ -19,8 +19,8 @@ $simpleString = "Bogus String Text"; echo isset($simpleString->wrong)?"bug\n":"ok\n"; try { echo isset($simpleString["wrong"])?"bug\n":"ok\n"; -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo isset($simpleString[-20])?"bug\n":"ok\n"; echo isset($simpleString[0])?"ok\n":"bug\n"; @@ -30,15 +30,15 @@ echo isset($simpleString["17"])?"bug\n":"ok\n"; echo $simpleString->wrong === null?"ok\n":"bug\n"; try { echo $simpleString["wrong"] === "B"?"ok\n":"bug\n"; -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $simpleString["0"] === "B"?"ok\n":"bug\n"; try { /* This must not affect the string value */ $simpleString["wrong"] = "f"; -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $simpleString["0"] === "B"?"ok\n":"bug\n"; ?> @@ -59,7 +59,7 @@ ok Warning: Attempt to read property "wrong" on string in %s on line %d ok -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string ok -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string ok diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt index 083ea78a0116..db04ef108ad5 100644 --- a/Zend/tests/bug31720.phpt +++ b/Zend/tests/bug31720.phpt @@ -6,10 +6,10 @@ $array = array('at least one element'); try { array_walk($array, array($nonesuchvar,'show')); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $nonesuchvar in %s on line %d -array_walk(): Argument #2 ($callback) must be a valid callback, first array member is not a valid class name or object +TypeError: array_walk(): Argument #2 ($callback) must be a valid callback, first array member is not a valid class name or object diff --git a/Zend/tests/bug33996.phpt b/Zend/tests/bug33996.phpt index d5ec3386d6e9..849667e9eed8 100644 --- a/Zend/tests/bug33996.phpt +++ b/Zend/tests/bug33996.phpt @@ -22,16 +22,16 @@ function NormalTest($a) try { NormalTest(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { FooTest(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } FooTest(new Foo()); ?> --EXPECTF-- -Exception: Too few arguments to function NormalTest(), 0 passed in %sbug33996.php on line 18 and exactly 1 expected -Exception: Too few arguments to function FooTest(), 0 passed in %sbug33996.php on line 23 and exactly 1 expected +ArgumentCountError: Too few arguments to function NormalTest(), 0 passed in %sbug33996.php on line 18 and exactly 1 expected +ArgumentCountError: Too few arguments to function FooTest(), 0 passed in %sbug33996.php on line 23 and exactly 1 expected Hello! diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt index b066ecd7abb9..dadd5a51ef23 100644 --- a/Zend/tests/bug37811.phpt +++ b/Zend/tests/bug37811.phpt @@ -19,8 +19,8 @@ define("Baz", new stdClass); var_dump(Baz); try { var_dump((string) Baz); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -30,4 +30,4 @@ object(TestClass)#1 (0) { string(3) "Foo" object(stdClass)#2 (0) { } -Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string diff --git a/Zend/tests/bug44660.phpt b/Zend/tests/bug44660.phpt index 02588c44b9d1..5a5c66f7216b 100644 --- a/Zend/tests/bug44660.phpt +++ b/Zend/tests/bug44660.phpt @@ -11,36 +11,36 @@ echo $a->p; echo "\n--> direct assignment:\n"; try { $a->p = $s; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n--> increment:\n"; try { $a->p++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n--> reference assignment:\n"; try { $a->p =& $s; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n--> reference assignment:\n"; try { $s =& $a->p; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n--> indexed assignment:\n"; try { $a->p[0] = $s; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n--> Confirm assignments have had no impact:\n"; @@ -51,19 +51,19 @@ var_dump($a); Warning: Attempt to read property "p" on true in %s on line %d --> direct assignment: -Attempt to assign property "p" on true +Error: Attempt to assign property "p" on true --> increment: -Attempt to increment/decrement property "p" on true +Error: Attempt to increment/decrement property "p" on true --> reference assignment: -Attempt to modify property "p" on true +Error: Attempt to modify property "p" on true --> reference assignment: -Attempt to modify property "p" on true +Error: Attempt to modify property "p" on true --> indexed assignment: -Attempt to modify property "p" on true +Error: Attempt to modify property "p" on true --> Confirm assignments have had no impact: bool(true) diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt index 7f0ae66debfe..dbb4a1bce219 100644 --- a/Zend/tests/bug46106.phpt +++ b/Zend/tests/bug46106.phpt @@ -17,11 +17,11 @@ function test($x) { $x = new ReflectionFunction('str_pad'); try { test($x); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> DONE --EXPECT-- -str_pad() expects at least 2 arguments, 1 given +ArgumentCountError: str_pad() expects at least 2 arguments, 1 given DONE From dc6e18cfb2b22613dc85c505ba30acca18c8419c Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:13:52 +0700 Subject: [PATCH 13/27] Zend: applied fixers to improve test robustness (part 2/8) (#23310) --- Zend/tests/bug47836.phpt | 6 +- Zend/tests/bug49893.phpt | 12 ++-- Zend/tests/bug52041.phpt | 36 +++++----- Zend/tests/bug52355.phpt | 6 +- Zend/tests/bug52614.phpt | 6 +- Zend/tests/bug53432.phpt | 18 ++--- Zend/tests/bug63882.phpt | 6 +- Zend/tests/bug65784.phpt | 6 +- Zend/tests/bug69017.phpt | 6 +- Zend/tests/bug69315.phpt | 36 +++++----- Zend/tests/bug70083.phpt | 6 +- Zend/tests/bug70089.phpt | 24 +++---- Zend/tests/bug70895.phpt | 18 ++--- Zend/tests/bug70898.phpt | 6 +- Zend/tests/bug70918.phpt | 36 +++++----- Zend/tests/bug71196.phpt | 6 +- Zend/tests/bug71572.phpt | 24 +++---- Zend/tests/bug72038.phpt | 12 ++-- Zend/tests/bug72107.phpt | 6 +- Zend/tests/bug74084.phpt | 24 +++---- Zend/tests/bug75218.phpt | 12 ++-- Zend/tests/bug75252.phpt | 12 ++-- Zend/tests/bug75921.phpt | 30 ++++---- Zend/tests/bug76869.phpt | 4 +- Zend/tests/bug78154.phpt | 10 +-- Zend/tests/bug78182.phpt | 6 +- Zend/tests/bug78531.phpt | 24 +++---- Zend/tests/bug78810.phpt | 12 ++-- Zend/tests/bug78926.phpt | 6 +- Zend/tests/bug79599.phpt | 12 ++-- Zend/tests/bug79947.phpt | 6 +- Zend/tests/bug80972.phpt | 10 +-- Zend/tests/bug81159.phpt | 8 +-- Zend/tests/call_to_abstract_method_args.phpt | 12 ++-- .../call_to_deprecated_function_args.phpt | 24 +++---- .../call_user_func_001.phpt | 12 ++-- .../call_user_func_002.phpt | 24 +++---- ...call_user_func_array_array_slice_type.phpt | 6 +- ...er_func_array_array_slice_type_strict.phpt | 12 ++-- .../call_user_func_array_invalid_type.phpt | 6 +- .../call_user_func_by_ref.phpt | 6 +- Zend/tests/callable_param_exception_leak.phpt | 6 +- .../class_name_as_scalar_error_007.phpt | 12 ++-- Zend/tests/class_name/class_on_object.phpt | 6 +- Zend/tests/clone/ast.phpt | 72 +++++++++---------- Zend/tests/closures/bug79778.phpt | 6 +- Zend/tests/closures/closure_015.phpt | 12 ++-- Zend/tests/closures/closure_021.phpt | 6 +- Zend/tests/closures/closure_027.phpt | 4 +- Zend/tests/closures/closure_031.phpt | 4 +- Zend/tests/closures/closure_040.phpt | 6 +- Zend/tests/closures/closure_059.phpt | 18 ++--- Zend/tests/closures/closure_063.phpt | 2 +- .../closures/closure_array_key_error.phpt | 6 +- .../closures/closure_array_offset_error.phpt | 6 +- .../attributes_ast_printing.phpt | 12 ++-- .../closures/closure_from_callable_error.phpt | 30 ++++---- ...e_from_callable_non_static_statically.phpt | 6 +- Zend/tests/closures/closure_get_current.phpt | 12 ++-- Zend/tests/closures/closure_instantiate.phpt | 8 +-- Zend/tests/closures/closure_write_prop.phpt | 6 +- Zend/tests/coalesce/assign_coalesce_002.phpt | 18 ++--- .../compound_assign_with_numeric_strings.phpt | 21 +++--- Zend/tests/concat/bug81705.phpt | 2 +- Zend/tests/constant_arrays.phpt | 6 +- Zend/tests/constants/008.phpt | 4 +- Zend/tests/constants/018.phpt | 6 +- Zend/tests/constants/bug44827.phpt | 12 ++-- Zend/tests/constants/bug51791.phpt | 6 +- .../constants/dynamic_class_const_fetch.phpt | 22 +++--- .../dynamic_class_const_fetch_order.phpt | 6 +- Zend/tests/constants/gh10709.phpt | 4 +- Zend/tests/constants/gh10709_2.phpt | 4 +- .../constant_expressions_exceptions_002.phpt | 6 +- Zend/tests/constexpr/gh7771_3.phpt | 1 - Zend/tests/constexpr/new.phpt | 24 +++---- Zend/tests/constexpr/new_named_params.phpt | 6 +- Zend/tests/constexpr/new_self_parent.phpt | 12 ++-- .../ctor_promotion/ctor_promotion_basic.phpt | 6 +- Zend/tests/div_002.phpt | 6 +- .../div_by_zero_compound_refcounted.phpt | 6 +- .../div_by_zero_compound_with_conversion.phpt | 6 +- Zend/tests/dynamic_call/bug48770_2.phpt | 12 ++-- Zend/tests/dynamic_call/bug48770_3.phpt | 6 +- Zend/tests/dynamic_call/bug68475.phpt | 12 ++-- 85 files changed, 502 insertions(+), 506 deletions(-) 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/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 From e1501d56b486147bf25253f3b5f37e713fb44b42 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:15:30 +0700 Subject: [PATCH 14/27] Zend: applied fixers to improve test robustness (3/8) (#23311) --- 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..51953c964fbc 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 60adb5034748179823c0df0e4773c09917188318 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:16:47 +0700 Subject: [PATCH 15/27] ext/json: applied fixers to improve test robustness (#23029) --- ext/json/tests/009.phpt | 1 - ext/json/tests/bug72787.phpt | 6 +++--- ext/json/tests/bug73113.phpt | 6 +++--- ext/json/tests/json_decode_error.phpt | 6 +++--- ext/json/tests/json_last_error_error.phpt | 6 +++--- ext/json/tests/json_last_error_msg_error.phpt | 6 +++--- ext/json/tests/json_last_error_msg_error_location_003.phpt | 1 - ext/json/tests/json_validate_003.phpt | 6 +++--- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git a/ext/json/tests/009.phpt b/ext/json/tests/009.phpt index ec9d9dd0f0ee..86ff78cb045c 100644 --- a/ext/json/tests/009.phpt +++ b/ext/json/tests/009.phpt @@ -11,4 +11,3 @@ echo "Done\n"; --EXPECT-- string(7) "[1,2,3]" Done - diff --git a/ext/json/tests/bug72787.phpt b/ext/json/tests/bug72787.phpt index c08bd18ec9b1..637c22014f42 100644 --- a/ext/json/tests/bug72787.phpt +++ b/ext/json/tests/bug72787.phpt @@ -7,10 +7,10 @@ Bug #72787 (json_decode reads out of bounds) try { var_dump(json_decode('[]', false, 0x100000000)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -json_decode(): Argument #3 ($depth) must be less than %d +ValueError: json_decode(): Argument #3 ($depth) must be less than %d diff --git a/ext/json/tests/bug73113.phpt b/ext/json/tests/bug73113.phpt index d22b0c23f71b..42167569d16d 100644 --- a/ext/json/tests/bug73113.phpt +++ b/ext/json/tests/bug73113.phpt @@ -15,9 +15,9 @@ class JsonSerializableObject implements \JsonSerializable $obj = new JsonSerializableObject(); try { echo json_encode($obj); -} catch (\Exception $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -This error is expected +Exception: This error is expected diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt index 93306a58b39d..d224813a98da 100644 --- a/ext/json/tests/json_decode_error.phpt +++ b/ext/json/tests/json_decode_error.phpt @@ -8,8 +8,8 @@ echo "\n-- Testing json_decode() function with depth below 0 --\n"; try { var_dump(json_decode('"abc"', true, -1)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -17,4 +17,4 @@ try { *** Testing json_decode() : error conditions *** -- Testing json_decode() function with depth below 0 -- -json_decode(): Argument #3 ($depth) must be greater than 0 +ValueError: json_decode(): Argument #3 ($depth) must be greater than 0 diff --git a/ext/json/tests/json_last_error_error.phpt b/ext/json/tests/json_last_error_error.phpt index d98d1988dbac..f098f4e39ceb 100644 --- a/ext/json/tests/json_last_error_error.phpt +++ b/ext/json/tests/json_last_error_error.phpt @@ -7,11 +7,11 @@ var_dump(json_last_error()); try { var_dump(json_last_error(true)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(0) -json_last_error() expects exactly 0 arguments, 1 given +ArgumentCountError: json_last_error() expects exactly 0 arguments, 1 given diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt index f34cdbbe624c..4afbdb2e744e 100644 --- a/ext/json/tests/json_last_error_msg_error.phpt +++ b/ext/json/tests/json_last_error_msg_error.phpt @@ -7,11 +7,11 @@ var_dump(json_last_error_msg()); try { var_dump(json_last_error_msg(true)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(8) "No error" -json_last_error_msg() expects exactly 0 arguments, 1 given +ArgumentCountError: json_last_error_msg() expects exactly 0 arguments, 1 given diff --git a/ext/json/tests/json_last_error_msg_error_location_003.phpt b/ext/json/tests/json_last_error_msg_error_location_003.phpt index ec5e6b9b4d65..702ba1f43889 100644 --- a/ext/json/tests/json_last_error_msg_error_location_003.phpt +++ b/ext/json/tests/json_last_error_msg_error_location_003.phpt @@ -69,4 +69,3 @@ Error on line 7, column 1: bool(false) int(4) string(30) "Syntax error near location 7:1" - diff --git a/ext/json/tests/json_validate_003.phpt b/ext/json/tests/json_validate_003.phpt index cd0545b9a7f9..e538ed72ee61 100644 --- a/ext/json/tests/json_validate_003.phpt +++ b/ext/json/tests/json_validate_003.phpt @@ -7,13 +7,13 @@ json_validate() - Error handling for max depth try { var_dump(json_validate("-", PHP_INT_MAX)); -} catch (ValueError $error) { - echo $error->getMessage() . PHP_EOL; +} catch (Throwable $error) { + echo $error::class, ': ', $error->getMessage(), "\n"; var_dump(json_last_error(), json_last_error_msg()); } ?> --EXPECTF-- -json_validate(): Argument #2 ($depth) must be less than %d +ValueError: json_validate(): Argument #2 ($depth) must be less than %d int(0) string(8) "No error" From 5f48e4d6a66c3cfe131e87c0060b2285bc1fb96a Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:18:48 +0700 Subject: [PATCH 16/27] Zend: applied fixers to improve test robustness (part 4/8) (#23312) --- .../variadic_argument_type_error.phpt | 12 ++-- Zend/tests/gc/bug54305.phpt | 6 +- Zend/tests/gc/bug80072.phpt | 6 +- Zend/tests/generators/bug79927.phpt | 6 +- Zend/tests/generators/dynamic_properties.phpt | 6 +- Zend/tests/generators/errors/count_error.phpt | 6 +- .../resume_running_generator_error.phpt | 6 +- .../resume_running_generator_error_002.phpt | 4 +- ...nerator_throwing_during_function_call.phpt | 6 +- .../generator_throwing_exception.phpt | 6 +- .../generator_with_type_check_2.phpt | 12 ++-- .../generators/get_return_and_finally.phpt | 12 ++-- Zend/tests/generators/get_return_errors.phpt | 36 +++++----- Zend/tests/generators/gh11028_1.phpt | 10 +-- Zend/tests/generators/gh11028_3.phpt | 4 +- .../throw_into_yield_from_array.phpt | 8 +-- .../generators/yield_from_non_iterable.phpt | 6 +- .../yield_from_valid_exception.phpt | 6 +- Zend/tests/get_called_class_001.phpt | 6 +- Zend/tests/get_class_basic.phpt | 24 +++---- .../get_class_vars/get_class_vars_001.phpt | 6 +- Zend/tests/get_parent_class_basic.phpt | 36 +++++----- Zend/tests/gh10169.phpt | 12 ++-- Zend/tests/gh10497_non_object.phpt | 66 +++++++++---------- Zend/tests/gh10634.phpt | 12 ++-- Zend/tests/gh12102_1.phpt | 6 +- Zend/tests/gh12102_3.phpt | 6 +- Zend/tests/gh14969.phpt | 8 +-- Zend/tests/gh17162.phpt | 6 +- Zend/tests/gh18736.phpt | 6 +- Zend/tests/gh19304.phpt | 6 +- Zend/tests/gh19306.phpt | 4 +- Zend/tests/gh19326.phpt | 6 +- Zend/tests/gh19719.phpt | 6 +- Zend/tests/gh20564.phpt | 4 +- Zend/tests/gh23088.phpt | 12 ++-- Zend/tests/gh418106144.phpt | 6 +- Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt | 6 +- Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt | 6 +- Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt | 6 +- Zend/tests/global_to_string_exception.phpt | 6 +- .../illegal_offset_unset_isset_empty.phpt | 18 ++--- ..._with_castable_objects_no_subtraction.phpt | 40 +++++------ .../in-de-crement/incdec_bool_exception.phpt | 16 ++--- .../incdec_strings_exception.phpt | 40 +++++------ Zend/tests/in-de-crement/incdec_types.phpt | 20 +++--- ...ent_with_castable_objects_no_addition.phpt | 40 +++++------ .../in-de-crement/object_cannot_incdec.phpt | 24 +++---- .../object_cannot_incdec_use_result_op.phpt | 24 +++---- Zend/tests/in-de-crement/oss_fuzz_63802.phpt | 12 ++-- .../in-de-crement/overloaded_access.phpt | 8 +-- ...rty_converted_to_obj_in_error_handler.phpt | 6 +- Zend/tests/incompat_ctx_user.phpt | 4 +- Zend/tests/indexing_001.phpt | 52 +++++++-------- .../indirect_call_array_003.phpt | 4 +- .../indirect_call_array_004.phpt | 24 +++---- .../indirect_call_string_002.phpt | 42 ++++++------ .../indirect_method_call_001.phpt | 6 +- .../tests/init_array_illegal_offset_type.phpt | 6 +- Zend/tests/int_static_prop_name.phpt | 18 ++--- Zend/tests/invalid_parent_const_ref_leak.phpt | 6 +- Zend/tests/isset/isset_array.phpt | 12 ++-- .../lazy_objects/rfc/rfc_example_006.phpt | 6 +- .../lazy_objects/typed_properties_001.phpt | 6 +- Zend/tests/live_range_phi_leak.phpt | 6 +- Zend/tests/magic_methods/bug26166.phpt | 12 ++-- Zend/tests/magic_methods/bug29368_2.phpt | 4 +- Zend/tests/magic_methods/bug45186.phpt | 6 +- Zend/tests/magic_methods/bug45186_2.phpt | 12 ++-- Zend/tests/magic_methods/bug76667.phpt | 6 +- Zend/tests/match/043.phpt | 26 ++++---- Zend/tests/match/045.phpt | 6 +- Zend/tests/match/048.phpt | 26 ++++---- Zend/tests/match/049.phpt | 26 ++++---- Zend/tests/match/unmatched_enum.phpt | 6 +- ...methods-on-non-objects-call-user-func.phpt | 6 +- Zend/tests/methods-on-non-objects-catch.phpt | 7 +- Zend/tests/methods-on-non-objects-usort.phpt | 16 ++--- Zend/tests/mod_001.phpt | 6 +- Zend/tests/mul_001.phpt | 6 +- Zend/tests/named_params/__invoke.phpt | 12 ++-- Zend/tests/named_params/assert.phpt | 18 ++--- Zend/tests/named_params/attributes.phpt | 6 +- Zend/tests/named_params/call_user_func.phpt | 16 ++--- .../named_params/call_user_func_array.phpt | 24 +++---- 85 files changed, 551 insertions(+), 556 deletions(-) diff --git a/Zend/tests/function_arguments/variadic_argument_type_error.phpt b/Zend/tests/function_arguments/variadic_argument_type_error.phpt index 9041aadcadfd..eb602deaa723 100644 --- a/Zend/tests/function_arguments/variadic_argument_type_error.phpt +++ b/Zend/tests/function_arguments/variadic_argument_type_error.phpt @@ -7,17 +7,17 @@ function foo($foo, int ...$bar) {} try { foo(1, []); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { foo(1, 1, 1, []); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECTF-- -foo(): Argument #2 must be of type int, array given, called in %s on line %d -foo(): Argument #4 must be of type int, array given, called in %s on line %d +TypeError: foo(): Argument #2 must be of type int, array given, called in %s on line %d +TypeError: foo(): Argument #4 must be of type int, array given, called in %s on line %d diff --git a/Zend/tests/gc/bug54305.phpt b/Zend/tests/gc/bug54305.phpt index 61e351306f78..36f3f898d95c 100644 --- a/Zend/tests/gc/bug54305.phpt +++ b/Zend/tests/gc/bug54305.phpt @@ -11,9 +11,9 @@ abstract class AbstractClass { $methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs'); try { echo $methodWithArgs++; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot increment ReflectionMethod +TypeError: Cannot increment ReflectionMethod diff --git a/Zend/tests/gc/bug80072.phpt b/Zend/tests/gc/bug80072.phpt index d7bf1956cf60..a03bda77fbc9 100644 --- a/Zend/tests/gc/bug80072.phpt +++ b/Zend/tests/gc/bug80072.phpt @@ -6,12 +6,12 @@ Bug #80072: Cyclic unserialize in TMPVAR operand may leak try { $s = 'O:8:"stdClass":1:{s:1:"x";r:1;}'; unserialize($s) % gc_collect_cycles(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $a[]=&$a == $a=&$b > gc_collect_cycles(); ?> --EXPECT-- -Unsupported operand types: stdClass % int +TypeError: Unsupported operand types: stdClass % int diff --git a/Zend/tests/generators/bug79927.phpt b/Zend/tests/generators/bug79927.phpt index df8f245ddfde..3b127a6ce510 100644 --- a/Zend/tests/generators/bug79927.phpt +++ b/Zend/tests/generators/bug79927.phpt @@ -11,8 +11,8 @@ $generator->next(); $generator->next(); try { $generator->rewind(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $generator->current(), "\n"; @@ -26,6 +26,6 @@ echo $generator2->current(), "\n"; ?> --EXPECT-- -Cannot rewind a generator that was already run +Exception: Cannot rewind a generator that was already run 3 4 diff --git a/Zend/tests/generators/dynamic_properties.phpt b/Zend/tests/generators/dynamic_properties.phpt index 08ceb7f581c6..6fb6bcefbf38 100644 --- a/Zend/tests/generators/dynamic_properties.phpt +++ b/Zend/tests/generators/dynamic_properties.phpt @@ -10,10 +10,10 @@ function gen() { $gen = gen(); try { $gen->prop = new stdClass; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property Generator::$prop +Error: Cannot create dynamic property Generator::$prop diff --git a/Zend/tests/generators/errors/count_error.phpt b/Zend/tests/generators/errors/count_error.phpt index 03ca1eed6032..e912376c056d 100644 --- a/Zend/tests/generators/errors/count_error.phpt +++ b/Zend/tests/generators/errors/count_error.phpt @@ -9,10 +9,10 @@ $gen = gen(); try { count($gen); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -count(): Argument #1 ($value) must be of type Countable|array, Generator given +TypeError: count(): Argument #1 ($value) must be of type Countable|array, Generator given diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt index 53e8611cf36c..c1a62dd75751 100644 --- a/Zend/tests/generators/errors/resume_running_generator_error.phpt +++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt @@ -7,8 +7,8 @@ function gen() { $gen = yield; try { $gen->next(); - } catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $gen->next(); } @@ -19,7 +19,7 @@ $gen->next(); ?> --EXPECTF-- -Exception: Cannot resume an already running generator +Error: Cannot resume an already running generator Fatal error: Uncaught Error: Cannot resume an already running generator in %s:%d Stack trace: diff --git a/Zend/tests/generators/errors/resume_running_generator_error_002.phpt b/Zend/tests/generators/errors/resume_running_generator_error_002.phpt index e71e32a886dc..8b0debf3bf8a 100644 --- a/Zend/tests/generators/errors/resume_running_generator_error_002.phpt +++ b/Zend/tests/generators/errors/resume_running_generator_error_002.phpt @@ -10,8 +10,8 @@ $gen = gen(); try { $gen->send($gen); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot resume an already running generator +Error: Cannot resume an already running generator diff --git a/Zend/tests/generators/generator_throwing_during_function_call.phpt b/Zend/tests/generators/generator_throwing_during_function_call.phpt index bd0d2448b7d8..885251f58381 100644 --- a/Zend/tests/generators/generator_throwing_during_function_call.phpt +++ b/Zend/tests/generators/generator_throwing_during_function_call.phpt @@ -19,8 +19,8 @@ var_dump($gen->current()); try { $gen->next(); -} catch (Exception $e) { - echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($gen->current()); @@ -28,5 +28,5 @@ var_dump($gen->current()); ?> --EXPECT-- string(3) "foo" -Caught exception with message "test" +Exception: test NULL diff --git a/Zend/tests/generators/generator_throwing_exception.phpt b/Zend/tests/generators/generator_throwing_exception.phpt index f537c3fc7726..48cdfa9eda82 100644 --- a/Zend/tests/generators/generator_throwing_exception.phpt +++ b/Zend/tests/generators/generator_throwing_exception.phpt @@ -15,8 +15,8 @@ var_dump($gen->current()); try { $gen->next(); -} catch (Exception $e) { - echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($gen->current()); @@ -24,5 +24,5 @@ var_dump($gen->current()); ?> --EXPECT-- string(3) "foo" -Caught exception with message "test" +Exception: test NULL diff --git a/Zend/tests/generators/generator_with_type_check_2.phpt b/Zend/tests/generators/generator_with_type_check_2.phpt index 21e8ab8bedc0..d1b8bb6798d8 100644 --- a/Zend/tests/generators/generator_with_type_check_2.phpt +++ b/Zend/tests/generators/generator_with_type_check_2.phpt @@ -5,18 +5,18 @@ Generator wit type check function gen(array $a) { yield; } try { gen(42); -} catch (TypeError $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foreach (gen(42) as $val) { var_dump($val); } -} catch (TypeError $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d -gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d +TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d +TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d diff --git a/Zend/tests/generators/get_return_and_finally.phpt b/Zend/tests/generators/get_return_and_finally.phpt index 8ced4d0008b5..4892075f4d77 100644 --- a/Zend/tests/generators/get_return_and_finally.phpt +++ b/Zend/tests/generators/get_return_and_finally.phpt @@ -30,19 +30,19 @@ try { // This will throw an exception (from the finally) // during auto-priming, so fails var_dump($gen->getReturn()); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // This fails, because the return value was discarded var_dump($gen->getReturn()); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: Returning from a finally block is deprecated in %s on line %d int(42) -gen2() throw -Cannot get return value of a generator that hasn't returned +Exception: gen2() throw +Exception: Cannot get return value of a generator that hasn't returned diff --git a/Zend/tests/generators/get_return_errors.phpt b/Zend/tests/generators/get_return_errors.phpt index f8d50aa3ded2..9db84883e274 100644 --- a/Zend/tests/generators/get_return_errors.phpt +++ b/Zend/tests/generators/get_return_errors.phpt @@ -13,8 +13,8 @@ $gen = gen1(); try { // Generator hasn't reached the "return" yet $gen->getReturn(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function gen2() { @@ -26,14 +26,14 @@ function gen2() { $gen = gen2(); try { $gen->next(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // Generator has been aborted as a result of an exception $gen->getReturn(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function gen3() { @@ -46,8 +46,8 @@ $gen = gen3(); try { // Generator throws during auto-priming of getReturn() call $gen->getReturn(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function gen4() { @@ -58,22 +58,22 @@ function gen4() { $gen = gen4(); try { $gen->throw(new Exception("gen4() throw")); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { // Generator has been aborted as a result of an exception // that was injected using throw() $gen->getReturn(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot get return value of a generator that hasn't returned -gen2() throw -Cannot get return value of a generator that hasn't returned -gen3() throw -gen4() throw -Cannot get return value of a generator that hasn't returned +Exception: Cannot get return value of a generator that hasn't returned +Exception: gen2() throw +Exception: Cannot get return value of a generator that hasn't returned +Exception: gen3() throw +Exception: gen4() throw +Exception: Cannot get return value of a generator that hasn't returned diff --git a/Zend/tests/generators/gh11028_1.phpt b/Zend/tests/generators/gh11028_1.phpt index d1c07dc9de66..7bd6f1ce3890 100644 --- a/Zend/tests/generators/gh11028_1.phpt +++ b/Zend/tests/generators/gh11028_1.phpt @@ -15,7 +15,7 @@ function test($msg, $x) { try { var_dump([...generator($x)]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,10 +27,10 @@ test("object", new stdClass); --EXPECTF-- Deprecated: Returning from a finally block is deprecated in %s on line %d yield null -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking yield false -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking yield true -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking yield object -Keys must be of type int|string during array unpacking +Error: Keys must be of type int|string during array unpacking diff --git a/Zend/tests/generators/gh11028_3.phpt b/Zend/tests/generators/gh11028_3.phpt index c58e00dc09b1..d5eee0cfaad3 100644 --- a/Zend/tests/generators/gh11028_3.phpt +++ b/Zend/tests/generators/gh11028_3.phpt @@ -14,9 +14,9 @@ function generator() { try { var_dump([...generator()]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: Returning from a finally block is deprecated in %s on line %d -exception +Exception: exception diff --git a/Zend/tests/generators/throw_into_yield_from_array.phpt b/Zend/tests/generators/throw_into_yield_from_array.phpt index aa9fa822061b..5cef784dfce4 100644 --- a/Zend/tests/generators/throw_into_yield_from_array.phpt +++ b/Zend/tests/generators/throw_into_yield_from_array.phpt @@ -19,8 +19,8 @@ function test($g) { var_dump($g->current()); try { $g->throw(new Exception("Exception!")); - } catch (Exception $e) { - echo "{$e->getMessage()}\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($g->current()); } @@ -35,9 +35,9 @@ test(yf(yielditer($data))); ?> --EXPECT-- int(1) -Exception! +Exception: Exception! NULL int(1) -Exception! +Exception: Exception! NULL diff --git a/Zend/tests/generators/yield_from_non_iterable.phpt b/Zend/tests/generators/yield_from_non_iterable.phpt index 705bcaec3511..7b1d21afbe77 100644 --- a/Zend/tests/generators/yield_from_non_iterable.phpt +++ b/Zend/tests/generators/yield_from_non_iterable.phpt @@ -9,10 +9,10 @@ function gen() { try { gen()->current(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Can use "yield from" only with arrays and Traversables +Error: Can use "yield from" only with arrays and Traversables diff --git a/Zend/tests/generators/yield_from_valid_exception.phpt b/Zend/tests/generators/yield_from_valid_exception.phpt index 0df541499cae..2ae43e9ad592 100644 --- a/Zend/tests/generators/yield_from_valid_exception.phpt +++ b/Zend/tests/generators/yield_from_valid_exception.phpt @@ -17,8 +17,8 @@ function gen() { try { // the fact that the yield from result is used is relevant. var_dump(yield from new FooBar); - } catch (Exception $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,4 +27,4 @@ $x->current(); ?> --EXPECT-- -Exception from valid() +Exception: Exception from valid() diff --git a/Zend/tests/get_called_class_001.phpt b/Zend/tests/get_called_class_001.phpt index caa6d154d9c5..d9a6a090e305 100644 --- a/Zend/tests/get_called_class_001.phpt +++ b/Zend/tests/get_called_class_001.phpt @@ -5,10 +5,10 @@ Calling get_called_class() outside a class try { var_dump(get_called_class()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -get_called_class() must be called from within a class +Error: get_called_class() must be called from within a class diff --git a/Zend/tests/get_class_basic.phpt b/Zend/tests/get_class_basic.phpt index f6dcbccb6916..bcdfeb22df91 100644 --- a/Zend/tests/get_class_basic.phpt +++ b/Zend/tests/get_class_basic.phpt @@ -11,8 +11,8 @@ class foo { { try { var_dump(get_class(null)); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -28,8 +28,8 @@ set_error_handler(function ($severity, $message, $file, $line) { }); try { $f1->bar(); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } set_error_handler(null); @@ -37,13 +37,13 @@ $f2->bar(); try { var_dump(get_class()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(get_class("qwerty")); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(get_class($f1)); @@ -54,13 +54,13 @@ $f1->testNull(); echo "Done\n"; ?> --EXPECTF-- -Calling get_class() without arguments is deprecated +Exception: Calling get_class() without arguments is deprecated Deprecated: Calling get_class() without arguments is deprecated in %s on line %d string(3) "foo" -get_class() without arguments must be called from within a class -get_class(): Argument #1 ($object) must be of type object, string given +Error: get_class() without arguments must be called from within a class +TypeError: get_class(): Argument #1 ($object) must be of type object, string given string(3) "foo" string(4) "foo2" -get_class(): Argument #1 ($object) must be of type object, null given +TypeError: get_class(): Argument #1 ($object) must be of type object, null given Done diff --git a/Zend/tests/get_class_vars/get_class_vars_001.phpt b/Zend/tests/get_class_vars/get_class_vars_001.phpt index a884409121c6..1f514b4aee3b 100644 --- a/Zend/tests/get_class_vars/get_class_vars_001.phpt +++ b/Zend/tests/get_class_vars/get_class_vars_001.phpt @@ -21,8 +21,8 @@ var_dump(get_class_vars('B')); try { get_class_vars("Unknown"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -37,4 +37,4 @@ array(2) { ["aa"]=> int(4) } -get_class_vars(): Argument #1 ($class) must be a valid class name, "Unknown" given +TypeError: get_class_vars(): Argument #1 ($class) must be a valid class name, "Unknown" given diff --git a/Zend/tests/get_parent_class_basic.phpt b/Zend/tests/get_parent_class_basic.phpt index 8eabd64ca455..12071196d7ae 100644 --- a/Zend/tests/get_parent_class_basic.phpt +++ b/Zend/tests/get_parent_class_basic.phpt @@ -27,8 +27,8 @@ set_error_handler(function ($severity, $message, $file, $line) { }); try { $foo->test(); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } set_error_handler(null); @@ -44,40 +44,40 @@ var_dump(get_parent_class("i")); try { get_parent_class(""); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { get_parent_class("[[[["); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { get_parent_class(" "); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(get_parent_class(new stdclass)); try { get_parent_class(array()); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { get_parent_class(1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- -Calling get_parent_class() without arguments is deprecated +Exception: Calling get_parent_class() without arguments is deprecated Deprecated: Calling get_parent_class() without arguments is deprecated in %s on line %d bool(false) @@ -90,10 +90,10 @@ bool(false) string(3) "foo" bool(false) bool(false) -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "" given -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "[[[[" given -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, " " given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "" given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "[[[[" given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, " " given bool(false) -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given -get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given +TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Done diff --git a/Zend/tests/gh10169.phpt b/Zend/tests/gh10169.phpt index 674122ac5935..44f62b7dcd53 100644 --- a/Zend/tests/gh10169.phpt +++ b/Zend/tests/gh10169.phpt @@ -19,19 +19,19 @@ class B $a = new A(); try { $a->prop = new B(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $a = new A(); $a->prop = ''; try { $a->prop = new B(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Object was released while assigning to property A::$prop -Object was released while assigning to property A::$prop +Error: Object was released while assigning to property A::$prop +Error: Object was released while assigning to property A::$prop diff --git a/Zend/tests/gh10497_non_object.phpt b/Zend/tests/gh10497_non_object.phpt index 546e9718443d..837fdf827c4b 100644 --- a/Zend/tests/gh10497_non_object.phpt +++ b/Zend/tests/gh10497_non_object.phpt @@ -5,20 +5,20 @@ GH-10497: Writing to a property of a non-object constant reports a runtime error try { TRUE->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { NULL->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { PHP_INT_MAX->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class C { @@ -33,47 +33,47 @@ class C { try { C::INT->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::STR->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::ARR->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::fromSelf(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Other write contexts: compound assignment, unset() and by-reference arguments. try { C::INT->prop++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { C::INT->prop .= 'x'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function byRef(&$v) {} try { byRef(C::INT->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // As for plain variables, unsetting a property of a non-object is a silent no-op. @@ -85,27 +85,27 @@ var_dump(isset(C::INT->prop)); try { __COMPILER_HALT_OFFSET__->prop = 1; -} catch (Error $e) { - echo $e::class, $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } __halt_compiler(); ?> --EXPECT-- -Attempt to assign property "prop" on true -Attempt to assign property "prop" on null -Attempt to assign property "prop" on int -Attempt to assign property "prop" on int -Attempt to assign property "prop" on string -Attempt to assign property "prop" on array -Attempt to assign property "prop" on int -Attempt to increment/decrement property "prop" on int -Attempt to assign property "prop" on int -Attempt to modify property "prop" on int +Error: Attempt to assign property "prop" on true +Error: Attempt to assign property "prop" on null +Error: Attempt to assign property "prop" on int +Error: Attempt to assign property "prop" on int +Error: Attempt to assign property "prop" on string +Error: Attempt to assign property "prop" on array +Error: Attempt to assign property "prop" on int +Error: Attempt to increment/decrement property "prop" on int +Error: Attempt to assign property "prop" on int +Error: Attempt to modify property "prop" on int unset() did not error bool(true) int(5) string(3) "str" bool(false) -ErrorAttempt to assign property "prop" on int +Error: Attempt to assign property "prop" on int diff --git a/Zend/tests/gh10634.phpt b/Zend/tests/gh10634.phpt index 41407bf307d7..cd36411b3792 100644 --- a/Zend/tests/gh10634.phpt +++ b/Zend/tests/gh10634.phpt @@ -6,7 +6,7 @@ function test_input($input) { try { eval($input); } catch(Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -17,8 +17,8 @@ test_input("y&# "); test_input("y&//"); ?> --EXPECT-- -string(36) "Unterminated comment starting line 1" -string(36) "Unterminated comment starting line 1" -string(36) "syntax error, unexpected end of file" -string(36) "syntax error, unexpected end of file" -string(36) "syntax error, unexpected end of file" +ParseError: Unterminated comment starting line 1 +ParseError: Unterminated comment starting line 1 +ParseError: syntax error, unexpected end of file +ParseError: syntax error, unexpected end of file +ParseError: syntax error, unexpected end of file diff --git a/Zend/tests/gh12102_1.phpt b/Zend/tests/gh12102_1.phpt index 1d548d6b28f3..84fb628525d8 100644 --- a/Zend/tests/gh12102_1.phpt +++ b/Zend/tests/gh12102_1.phpt @@ -7,8 +7,8 @@ function test() { byVal(func_get_args()[0]); try { byRef(func_get_args()[0]); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,4 +27,4 @@ test('y'); ?> --EXPECT-- string(1) "y" -Cannot use temporary expression in write context +Error: Cannot use temporary expression in write context diff --git a/Zend/tests/gh12102_3.phpt b/Zend/tests/gh12102_3.phpt index 741bce5ab1ba..99c51d5188c4 100644 --- a/Zend/tests/gh12102_3.phpt +++ b/Zend/tests/gh12102_3.phpt @@ -7,8 +7,8 @@ function test() { byVal(C[0]); try { byRef(C[0]); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,4 +29,4 @@ test('y'); ?> --EXPECT-- string(3) "foo" -Cannot use temporary expression in write context +Error: Cannot use temporary expression in write context diff --git a/Zend/tests/gh14969.phpt b/Zend/tests/gh14969.phpt index dedbaa7456e0..a69a739f0e37 100644 --- a/Zend/tests/gh14969.phpt +++ b/Zend/tests/gh14969.phpt @@ -20,7 +20,7 @@ $d = new D(); try { $d->prop = $c; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($d); @@ -29,18 +29,18 @@ $d->prop = 'foo'; try { $d->prop = $c; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($d); ?> --EXPECTF-- -C::__toString +Exception: C::__toString object(D)#%d (0) { ["prop"]=> uninitialized(string) } -C::__toString +Exception: C::__toString object(D)#2 (1) { ["prop"]=> string(3) "foo" diff --git a/Zend/tests/gh17162.phpt b/Zend/tests/gh17162.phpt index bdf6ddbb36ba..fb416cae26a3 100644 --- a/Zend/tests/gh17162.phpt +++ b/Zend/tests/gh17162.phpt @@ -13,9 +13,9 @@ $box = [new Test]; // but any function that uses zend_try_array_init() would work. try { getimagesize("dummy", $box); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attempt to assign property "value" on null +Error: Attempt to assign property "value" on null diff --git a/Zend/tests/gh18736.phpt b/Zend/tests/gh18736.phpt index f397ee39a310..385ab0f99edb 100644 --- a/Zend/tests/gh18736.phpt +++ b/Zend/tests/gh18736.phpt @@ -15,10 +15,10 @@ function &test(): int { try { $x = &test(); var_dump($x); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -test(): Return value must be of type int, string returned +TypeError: test(): Return value must be of type int, string returned diff --git a/Zend/tests/gh19304.phpt b/Zend/tests/gh19304.phpt index 47e20af64623..f3f7fab3f1fe 100644 --- a/Zend/tests/gh19304.phpt +++ b/Zend/tests/gh19304.phpt @@ -9,10 +9,10 @@ $foo = new class { try { $foo->v = 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign int to property class@anonymous::$v of type self +TypeError: Cannot assign int to property class@anonymous::$v of type self diff --git a/Zend/tests/gh19306.phpt b/Zend/tests/gh19306.phpt index e19735d94c84..9f98dd4cc6e2 100644 --- a/Zend/tests/gh19306.phpt +++ b/Zend/tests/gh19306.phpt @@ -26,7 +26,7 @@ echo "Fiber suspended\n"; try { $a->next(); } catch (Throwable $t) { - echo $t->getMessage(), "\n"; + echo $t::class, ': ', $t->getMessage(), "\n"; } echo "Destroying fiber\n"; $fiber = null; @@ -35,6 +35,6 @@ echo "Shutdown\n"; --EXPECT-- Fiber start Fiber suspended -Cannot resume an already running generator +Error: Cannot resume an already running generator Destroying fiber Shutdown diff --git a/Zend/tests/gh19326.phpt b/Zend/tests/gh19326.phpt index 335fdd382ea6..630d7ce2e8b0 100644 --- a/Zend/tests/gh19326.phpt +++ b/Zend/tests/gh19326.phpt @@ -25,12 +25,12 @@ $fiber->start(); try { $b->throw(new Exception('test')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $fiber->resume(); ?> --EXPECT-- -Cannot resume an already running generator +Error: Cannot resume an already running generator diff --git a/Zend/tests/gh19719.phpt b/Zend/tests/gh19719.phpt index 715e847846fe..9042b4139abf 100644 --- a/Zend/tests/gh19719.phpt +++ b/Zend/tests/gh19719.phpt @@ -12,10 +12,10 @@ function takesInt(int $x) {} try { takesInt('42'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d +TypeError: takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d diff --git a/Zend/tests/gh20564.phpt b/Zend/tests/gh20564.phpt index 53311d952de7..6962c7f19bd9 100644 --- a/Zend/tests/gh20564.phpt +++ b/Zend/tests/gh20564.phpt @@ -16,9 +16,9 @@ class A { try { (new A)->test(); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -array_map(): Argument #1 ($callback) must be a valid callback or null, class "B" not found +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, class "B" not found diff --git a/Zend/tests/gh23088.phpt b/Zend/tests/gh23088.phpt index 59153a1f2ba3..a979f47d7848 100644 --- a/Zend/tests/gh23088.phpt +++ b/Zend/tests/gh23088.phpt @@ -24,17 +24,17 @@ for ($i = 0; $i < 20000; $i++) { try { var_dump($a == $b); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($a === $b); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Maximum call stack size reached during comparison -Maximum call stack size reached during comparison +Error: Maximum call stack size reached during comparison +Error: Maximum call stack size reached during comparison diff --git a/Zend/tests/gh418106144.phpt b/Zend/tests/gh418106144.phpt index 9357b0a179b1..c2d689c7ec13 100644 --- a/Zend/tests/gh418106144.phpt +++ b/Zend/tests/gh418106144.phpt @@ -11,10 +11,10 @@ function test($y=new Foo>''){ } try { test(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Foo::__toString(): Return value must be of type string, none returned +TypeError: Foo::__toString(): Return value must be of type string, none returned diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt index d0e9ddcba410..b306eb884c76 100644 --- a/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt +++ b/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt @@ -17,10 +17,10 @@ $foo = new Foo(); try { $foo->foo()->baz ??= 1; -} catch (Exception $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Hello +Exception: Hello diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt index 4115d9eae26f..e4516a1eece1 100644 --- a/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt +++ b/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt @@ -15,10 +15,10 @@ $foo = new Foo(); try { $foo->foo()->prop ??= 'foo'; -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to property Foo::$prop of type int +TypeError: Cannot assign string to property Foo::$prop of type int diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt index f2808afbf84d..3aa8d89fb318 100644 --- a/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt +++ b/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt @@ -13,10 +13,10 @@ function newFoo() { try { newFoo()->prop ??= 'foo'; -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to property Foo::$prop of type int +TypeError: Cannot assign string to property Foo::$prop of type int diff --git a/Zend/tests/global_to_string_exception.phpt b/Zend/tests/global_to_string_exception.phpt index 0c55a8c3d624..25ea7cc4c786 100644 --- a/Zend/tests/global_to_string_exception.phpt +++ b/Zend/tests/global_to_string_exception.phpt @@ -5,10 +5,10 @@ To string conversion failure in global try { global ${new stdClass}; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string diff --git a/Zend/tests/illegal_offset_unset_isset_empty.phpt b/Zend/tests/illegal_offset_unset_isset_empty.phpt index ee837f0b6143..2a78387f4c63 100644 --- a/Zend/tests/illegal_offset_unset_isset_empty.phpt +++ b/Zend/tests/illegal_offset_unset_isset_empty.phpt @@ -6,22 +6,22 @@ Using unset(), isset(), empty() with an illegal array offset throws $ary = []; try { unset($ary[[]]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($ary[[]]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { empty($ary[[]]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot unset offset of type array on array -Cannot access offset of type array in isset or empty -Cannot access offset of type array in isset or empty +TypeError: Cannot unset offset of type array on array +TypeError: Cannot access offset of type array in isset or empty +TypeError: Cannot access offset of type array in isset or empty diff --git a/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt b/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt index 21b4a9b01684..1384661d25c5 100644 --- a/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt +++ b/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt @@ -13,64 +13,64 @@ $nf = new NumericCastableNoOperations(58.3); /* Check normal arithmetic */ try { var_dump($l - 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($f - 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nl - 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nf - 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } /* Decrement */ try { $l--; var_dump($l); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f--; var_dump($f); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nl--; var_dump($nl); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nf--; var_dump($nf); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: LongCastableNoOperations - int -Unsupported operand types: FloatCastableNoOperations - int +TypeError: Unsupported operand types: LongCastableNoOperations - int +TypeError: Unsupported operand types: FloatCastableNoOperations - int int(51) float(57.3) -Cannot decrement LongCastableNoOperations -Cannot decrement FloatCastableNoOperations +TypeError: Cannot decrement LongCastableNoOperations +TypeError: Cannot decrement FloatCastableNoOperations int(51) float(57.3) diff --git a/Zend/tests/in-de-crement/incdec_bool_exception.phpt b/Zend/tests/in-de-crement/incdec_bool_exception.phpt index f819af1e2395..3ebad74c0a00 100644 --- a/Zend/tests/in-de-crement/incdec_bool_exception.phpt +++ b/Zend/tests/in-de-crement/incdec_bool_exception.phpt @@ -11,18 +11,18 @@ $values = [false, true]; foreach ($values as $value) { try { $value++; - } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $value--; - } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Increment on type bool has no effect, this will change in the next major version of PHP -Decrement on type bool has no effect, this will change in the next major version of PHP -Increment on type bool has no effect, this will change in the next major version of PHP -Decrement on type bool has no effect, this will change in the next major version of PHP +Exception: Increment on type bool has no effect, this will change in the next major version of PHP +Exception: Decrement on type bool has no effect, this will change in the next major version of PHP +Exception: Increment on type bool has no effect, this will change in the next major version of PHP +Exception: Decrement on type bool has no effect, this will change in the next major version of PHP diff --git a/Zend/tests/in-de-crement/incdec_strings_exception.phpt b/Zend/tests/in-de-crement/incdec_strings_exception.phpt index 5acbb1041222..c6a1891c991a 100644 --- a/Zend/tests/in-de-crement/incdec_strings_exception.phpt +++ b/Zend/tests/in-de-crement/incdec_strings_exception.phpt @@ -28,48 +28,48 @@ $values = [ foreach ($values as $value) { try { $value++; - } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($value); try { $value--; - } catch (\Exception $e) { - echo $e->getMessage(), PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($value); } ?> --EXPECT-- -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(0) "" -Deprecated: Decrement on empty string is deprecated as non-numeric +Exception: Deprecated: Decrement on empty string is deprecated as non-numeric string(0) "" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(1) " " -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(1) " " -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "199A" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "199A" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "A199" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "A199" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "199Z" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "199Z" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "Z199" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "Z199" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(11) "Hello world" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(11) "Hello world" -Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead +Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead string(4) "🐘" -Deprecated: Decrement on non-numeric string has no effect and is deprecated +Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated string(4) "🐘" diff --git a/Zend/tests/in-de-crement/incdec_types.phpt b/Zend/tests/in-de-crement/incdec_types.phpt index 755b63957ef3..9b99b9baa45d 100644 --- a/Zend/tests/in-de-crement/incdec_types.phpt +++ b/Zend/tests/in-de-crement/incdec_types.phpt @@ -9,13 +9,13 @@ $types = [[], new stdClass(), fopen(__FILE__, 'r')]; foreach ($types as $type) { try { $type++; - } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $type--; - } catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -40,12 +40,12 @@ foreach ($values as $value) { } ?> --EXPECTF-- -Cannot increment array -Cannot decrement array -Cannot increment stdClass -Cannot decrement stdClass -Cannot increment resource -Cannot decrement resource +TypeError: Cannot increment array +TypeError: Cannot decrement array +TypeError: Cannot increment stdClass +TypeError: Cannot decrement stdClass +TypeError: Cannot increment resource +TypeError: Cannot decrement resource Using increment: Initial value:NULL Result value:int(1) diff --git a/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt b/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt index cf08055383ed..8ee4cd33856a 100644 --- a/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt +++ b/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt @@ -13,64 +13,64 @@ $nf = new NumericCastableNoOperations(58.3); /* Check normal arithmetic */ try { var_dump($l + 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($f + 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nl + 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($nf + 1); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } /* Decrement */ try { $l++; var_dump($l); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $f++; var_dump($f); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nl++; var_dump($nl); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $nf++; var_dump($nf); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unsupported operand types: LongCastableNoOperations + int -Unsupported operand types: FloatCastableNoOperations + int +TypeError: Unsupported operand types: LongCastableNoOperations + int +TypeError: Unsupported operand types: FloatCastableNoOperations + int int(53) float(59.3) -Cannot increment LongCastableNoOperations -Cannot increment FloatCastableNoOperations +TypeError: Cannot increment LongCastableNoOperations +TypeError: Cannot increment FloatCastableNoOperations int(53) float(59.3) diff --git a/Zend/tests/in-de-crement/object_cannot_incdec.phpt b/Zend/tests/in-de-crement/object_cannot_incdec.phpt index 39a41d61dd3e..cfa5cca2dd50 100644 --- a/Zend/tests/in-de-crement/object_cannot_incdec.phpt +++ b/Zend/tests/in-de-crement/object_cannot_incdec.phpt @@ -7,39 +7,39 @@ $o = new Foo; try { $o++; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $o--; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { ++$o; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { --$o; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } ?> --EXPECT-- -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } diff --git a/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt b/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt index b4c193a67182..370fe8603fd9 100644 --- a/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt +++ b/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt @@ -7,39 +7,39 @@ $o = new Foo; try { $y = $o++; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $y = $o--; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $y = ++$o; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } try { $y = --$o; -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($o); } ?> --EXPECT-- -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } -Cannot increment Foo +TypeError: Cannot increment Foo object(Foo)#1 (0) { } -Cannot decrement Foo +TypeError: Cannot decrement Foo object(Foo)#1 (0) { } diff --git a/Zend/tests/in-de-crement/oss_fuzz_63802.phpt b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt index 51b4c8f1fd72..96b50d1022f2 100644 --- a/Zend/tests/in-de-crement/oss_fuzz_63802.phpt +++ b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt @@ -21,14 +21,14 @@ foreach (['pre', 'post'] as $prePost) { foreach (['inc', 'dec'] as $incDec) { try { $foo->{$prePost . ucfirst($incDec)}(); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } ?> --EXPECT-- -Cannot increment Foo -Cannot decrement Foo -Cannot increment Foo -Cannot decrement Foo +TypeError: Cannot increment Foo +TypeError: Cannot decrement Foo +TypeError: Cannot increment Foo +TypeError: Cannot decrement Foo diff --git a/Zend/tests/in-de-crement/overloaded_access.phpt b/Zend/tests/in-de-crement/overloaded_access.phpt index 56a5c2b1d47a..feb15c60c6cf 100644 --- a/Zend/tests/in-de-crement/overloaded_access.phpt +++ b/Zend/tests/in-de-crement/overloaded_access.phpt @@ -22,15 +22,15 @@ $foo = new Foo; try { $foo[0]++; } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } $foo = new Foo; try { $foo[0]--; } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Cannot increment array -Cannot decrement array +TypeError: Cannot increment array +TypeError: Cannot decrement array diff --git a/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt b/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt index d435c9fb4029..8b8b0a1fe71f 100644 --- a/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt +++ b/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt @@ -14,12 +14,12 @@ unset($c->a); try { (++$c->a); -} catch (\TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($c->a); ?> --EXPECT-- -Cannot increment stdClass +TypeError: Cannot increment stdClass object(stdClass)#2 (0) { } diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt index 3fe0456175f0..a50c769b3da7 100644 --- a/Zend/tests/incompat_ctx_user.phpt +++ b/Zend/tests/incompat_ctx_user.phpt @@ -13,8 +13,8 @@ $b = new B; try { $b->bar(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Non-static method A::foo() cannot be called statically +Error: Non-static method A::foo() cannot be called statically diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt index 66b20da03a03..acb1ab10874b 100644 --- a/Zend/tests/indexing_001.phpt +++ b/Zend/tests/indexing_001.phpt @@ -9,8 +9,8 @@ $testvalues=array(null, 0, 1, true, false,'',' ',0.1,array()); foreach ($testvalues as $testvalue) { try { $testvalue['foo']=$array; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($testvalue); } @@ -21,8 +21,8 @@ $testvalues=array(null, 0, 1, true, false,0.1,array()); foreach ($testvalues as $testvalue) { try { $testvalue['foo']=&$array; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($testvalue); } @@ -33,8 +33,8 @@ $testvalues=array(null, 0, 1, true, false,0.1,array()); foreach ($testvalues as $testvalue) { try { $testvalue[]=$array; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump ($testvalue); } @@ -45,8 +45,8 @@ $testvalues=array(null, 0, 1, true, false,0.1,array()); foreach ($testvalues as $testvalue) { try { $testvalue[]=&$array; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump ($testvalue); } @@ -61,11 +61,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -76,11 +76,11 @@ array(1) { int(1) } } -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(0) "" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(1) " " -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { ["foo"]=> @@ -98,11 +98,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -113,7 +113,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { ["foo"]=> @@ -130,11 +130,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -145,7 +145,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { [0]=> @@ -163,11 +163,11 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(0) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array int(1) -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array bool(true) Deprecated: Automatic conversion of false to array is deprecated in %s @@ -178,7 +178,7 @@ array(1) { int(1) } } -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array float(0.1) array(1) { [0]=> diff --git a/Zend/tests/indirect_function_call/indirect_call_array_003.phpt b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt index 603b3bfc299b..30d84109ce31 100644 --- a/Zend/tests/indirect_function_call/indirect_call_array_003.phpt +++ b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt @@ -20,7 +20,7 @@ $arr = array('foo', 'abc'); try { $arr(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo = new foo; $arr = array($foo, 'abc'); @@ -31,7 +31,7 @@ $arr(); --EXPECTF-- From foo::__callStatic: string(3) "abc" -Exception: Using $this when not in object context +Error: Using $this when not in object context From foo::__call: string(3) "abc" object(foo)#%d (0) { diff --git a/Zend/tests/indirect_function_call/indirect_call_array_004.phpt b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt index e8520efd12b0..c1992a289082 100644 --- a/Zend/tests/indirect_function_call/indirect_call_array_004.phpt +++ b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt @@ -23,8 +23,8 @@ $arr = array('foo', 'abc'); try { $arr(); } -catch (Exception $e) { - echo $e->getMessage(), "\n"; +catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $arr = array('foo', '123'); @@ -32,8 +32,8 @@ $arr = array('foo', '123'); try { $arr(); } -catch (Exception $e) { - echo $e->getMessage(), "\n"; +catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -45,8 +45,8 @@ $arr = array($foo, 'abc'); try { $arr(); } -catch (Exception $e) { - echo $e->getMessage(), "\n"; +catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -56,16 +56,16 @@ $arr = array($foo, '123'); try { $arr(); } -catch (Exception $e) { - echo $e->getMessage(), "\n"; +catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -foo +Exception: foo From foo::__callStatic: -123 +Exception: 123 ------ -foo +Exception: foo From foo::__call: -123 +Exception: 123 diff --git a/Zend/tests/indirect_function_call/indirect_call_string_002.phpt b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt index 7704c1cd9a4d..2c5c22a29ada 100644 --- a/Zend/tests/indirect_function_call/indirect_call_string_002.phpt +++ b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt @@ -22,65 +22,65 @@ $callback(); $callback = ['', 'method']; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test Class::method syntax with empty class name $callback = '::method'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test array syntax with empty class and method name $callback = ['', '']; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test Class::method syntax with empty class and method name $callback = '::'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test string ending in single colon $callback = 'Class:'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test string beginning in single colon $callback = ':method'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test single colon $callback = ':'; try { $callback(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(0) "" string(0) "" -Class "" not found -Class "" not found -Class "" not found -Class "" not found -Call to undefined function Class:() -Call to undefined function :method() -Call to undefined function :() +Error: Class "" not found +Error: Class "" not found +Error: Class "" not found +Error: Class "" not found +Error: Call to undefined function Class:() +Error: Call to undefined function :method() +Error: Call to undefined function :() diff --git a/Zend/tests/indirect_function_call/indirect_method_call_001.phpt b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt index 39967fdb267d..394e0277919f 100644 --- a/Zend/tests/indirect_function_call/indirect_method_call_001.phpt +++ b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt @@ -11,10 +11,10 @@ class foo { try { $X = (new foo)->Inexistent(3); -} catch (Exception $e) { - var_dump($e->getMessage()); // foobar +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; // foobar } ?> --EXPECT-- -string(6) "foobar" +Exception: foobar diff --git a/Zend/tests/init_array_illegal_offset_type.phpt b/Zend/tests/init_array_illegal_offset_type.phpt index ee41c0217ad7..a7575fe15543 100644 --- a/Zend/tests/init_array_illegal_offset_type.phpt +++ b/Zend/tests/init_array_illegal_offset_type.phpt @@ -7,9 +7,9 @@ function test() { } try { test(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access offset of type stdClass on array +TypeError: Cannot access offset of type stdClass on array diff --git a/Zend/tests/int_static_prop_name.phpt b/Zend/tests/int_static_prop_name.phpt index e29e2514bb97..27a3c521aa5f 100644 --- a/Zend/tests/int_static_prop_name.phpt +++ b/Zend/tests/int_static_prop_name.phpt @@ -16,20 +16,20 @@ var_dump(${(int) $n}); try { var_dump(Foo::${42}); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::${(int) 42}); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::${(int) $n}); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -37,6 +37,6 @@ try { int(24) int(24) int(24) -Access to undeclared static property Foo::$42 -Access to undeclared static property Foo::$42 -Access to undeclared static property Foo::$42 +Error: Access to undeclared static property Foo::$42 +Error: Access to undeclared static property Foo::$42 +Error: Access to undeclared static property Foo::$42 diff --git a/Zend/tests/invalid_parent_const_ref_leak.phpt b/Zend/tests/invalid_parent_const_ref_leak.phpt index ed728f7d45e4..cf102c14e985 100644 --- a/Zend/tests/invalid_parent_const_ref_leak.phpt +++ b/Zend/tests/invalid_parent_const_ref_leak.phpt @@ -9,10 +9,10 @@ class A { try { A::B; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access "parent" when current class scope has no parent +Error: Cannot access "parent" when current class scope has no parent diff --git a/Zend/tests/isset/isset_array.phpt b/Zend/tests/isset/isset_array.phpt index 48e908a36d56..f74498b7c479 100644 --- a/Zend/tests/isset/isset_array.phpt +++ b/Zend/tests/isset/isset_array.phpt @@ -24,14 +24,14 @@ var_dump(isset($array[STDIN])); try { isset($array[[]]); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { isset($array[new stdClass()]); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECTF-- @@ -48,5 +48,5 @@ bool(false) Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d bool(false) -Cannot access offset of type array in isset or empty -Cannot access offset of type stdClass in isset or empty +TypeError: Cannot access offset of type array in isset or empty +TypeError: Cannot access offset of type stdClass in isset or empty diff --git a/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt b/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt index c46756718649..15cf5fdad65c 100644 --- a/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt +++ b/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt @@ -32,8 +32,8 @@ var_dump($object2); try { var_dump($object1->propB); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // The state of both objects is unchanged @@ -52,7 +52,7 @@ lazy ghost object(MyClass)#%d (1) { ["propA"]=> string(8) "object-2" } -initializer exception +Exception: initializer exception lazy ghost object(MyClass)#%d (1) { ["propA"]=> string(8) "object-1" diff --git a/Zend/tests/lazy_objects/typed_properties_001.phpt b/Zend/tests/lazy_objects/typed_properties_001.phpt index 1f457531d87c..06b7689900b6 100644 --- a/Zend/tests/lazy_objects/typed_properties_001.phpt +++ b/Zend/tests/lazy_objects/typed_properties_001.phpt @@ -20,14 +20,14 @@ $test = $reflector->newLazyProxy(function () { $ref = "foobar"; try { $test->$name =& $ref; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); ?> --EXPECTF-- -Cannot assign string to property Test::$prop of type int +TypeError: Cannot assign string to property Test::$prop of type int lazy proxy object(Test)#%d (1) { ["instance"]=> object(Test)#%d (0) { diff --git a/Zend/tests/live_range_phi_leak.phpt b/Zend/tests/live_range_phi_leak.phpt index f07258405301..d5d70f0a3c1a 100644 --- a/Zend/tests/live_range_phi_leak.phpt +++ b/Zend/tests/live_range_phi_leak.phpt @@ -11,9 +11,9 @@ function test($k) { } try { test(new stdClass); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Test +Exception: Test diff --git a/Zend/tests/magic_methods/bug26166.phpt b/Zend/tests/magic_methods/bug26166.phpt index 3e5c6daa21d4..7e1c48790800 100644 --- a/Zend/tests/magic_methods/bug26166.phpt +++ b/Zend/tests/magic_methods/bug26166.phpt @@ -40,8 +40,8 @@ class NoneTest $o = new NoneTest; try { echo $o; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "===THROW===\n"; @@ -56,14 +56,14 @@ class ErrorTest $o = new ErrorTest; try { echo $o; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- Hello World! ===NONE=== -NoneTest::__toString(): Return value must be of type string, none returned +TypeError: NoneTest::__toString(): Return value must be of type string, none returned ===THROW=== -This is an error! +Exception: This is an error! diff --git a/Zend/tests/magic_methods/bug29368_2.phpt b/Zend/tests/magic_methods/bug29368_2.phpt index e13d6da88467..fda92130c504 100644 --- a/Zend/tests/magic_methods/bug29368_2.phpt +++ b/Zend/tests/magic_methods/bug29368_2.phpt @@ -12,10 +12,10 @@ class Bomb { try { $x = new ReflectionMethod(new Bomb(), "foo"); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "ok\n"; ?> --EXPECT-- -bomb! +Exception: bomb! ok diff --git a/Zend/tests/magic_methods/bug45186.phpt b/Zend/tests/magic_methods/bug45186.phpt index 9e0078d77002..6722ea397186 100644 --- a/Zend/tests/magic_methods/bug45186.phpt +++ b/Zend/tests/magic_methods/bug45186.phpt @@ -33,8 +33,8 @@ call_user_func(array('BAR','x')); call_user_func('BAR::www'); try { call_user_func('self::y'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -58,4 +58,4 @@ string(1) "y" ok __callstatic: string(3) "www" -call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active diff --git a/Zend/tests/magic_methods/bug45186_2.phpt b/Zend/tests/magic_methods/bug45186_2.phpt index e85528ce8b00..bea4427ade40 100644 --- a/Zend/tests/magic_methods/bug45186_2.phpt +++ b/Zend/tests/magic_methods/bug45186_2.phpt @@ -28,13 +28,13 @@ $x->test(); call_user_func(array('BAR','x')); try { call_user_func('BAR::www'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func('self::y'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -56,5 +56,5 @@ Deprecated: Use of "self" in callables is deprecated in %s on line %d __call: string(1) "y" ok -call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www" -call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www" +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active diff --git a/Zend/tests/magic_methods/bug76667.phpt b/Zend/tests/magic_methods/bug76667.phpt index 03bd490a0409..d27ea5e18d53 100644 --- a/Zend/tests/magic_methods/bug76667.phpt +++ b/Zend/tests/magic_methods/bug76667.phpt @@ -18,12 +18,12 @@ class T { $x = new T; try { $x->x = 1; -} catch (\DivisionByZeroError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $undefined in %s on line %d Warning: Attempt to read property "1" on null in %s on line %d -Division by zero +DivisionByZeroError: Division by zero diff --git a/Zend/tests/match/043.phpt b/Zend/tests/match/043.phpt index 03ff0cbf36d6..32ec8bcac38a 100644 --- a/Zend/tests/match/043.phpt +++ b/Zend/tests/match/043.phpt @@ -8,8 +8,8 @@ class Beep {} function test(mixed $var) { try { match($var) {}; - } catch (UnhandledMatchError $e) { - print $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,14 +27,14 @@ test(str_repeat('e', 100)); test(str_repeat("e\n", 100)); ?> --EXPECT-- -Unhandled match case NULL -Unhandled match case 1 -Unhandled match case 5.5 -Unhandled match case 5.0 -Unhandled match case 'foo' -Unhandled match case true -Unhandled match case false -Unhandled match case of type array -Unhandled match case of type Beep -Unhandled match case 'eeeeeeeeeeeeeee...' -Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...' +UnhandledMatchError: Unhandled match case NULL +UnhandledMatchError: Unhandled match case 1 +UnhandledMatchError: Unhandled match case 5.5 +UnhandledMatchError: Unhandled match case 5.0 +UnhandledMatchError: Unhandled match case 'foo' +UnhandledMatchError: Unhandled match case true +UnhandledMatchError: Unhandled match case false +UnhandledMatchError: Unhandled match case of type array +UnhandledMatchError: Unhandled match case of type Beep +UnhandledMatchError: Unhandled match case 'eeeeeeeeeeeeeee...' +UnhandledMatchError: Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...' diff --git a/Zend/tests/match/045.phpt b/Zend/tests/match/045.phpt index da8991cf595c..77b6e58d7a34 100644 --- a/Zend/tests/match/045.phpt +++ b/Zend/tests/match/045.phpt @@ -10,9 +10,9 @@ function test() { } try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "x" +Error: Undefined constant "x" diff --git a/Zend/tests/match/048.phpt b/Zend/tests/match/048.phpt index e5c6bb2e0bcb..008b83fbc1a0 100644 --- a/Zend/tests/match/048.phpt +++ b/Zend/tests/match/048.phpt @@ -10,8 +10,8 @@ class Beep {} function test(mixed $var) { try { match($var) {}; - } catch (UnhandledMatchError $e) { - print $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,14 +29,14 @@ test(str_repeat('e', 100)); test(str_repeat("e\n", 100)); ?> --EXPECT-- -Unhandled match case NULL -Unhandled match case 1 -Unhandled match case 5.5 -Unhandled match case 5.0 -Unhandled match case of type string -Unhandled match case true -Unhandled match case false -Unhandled match case of type array -Unhandled match case of type Beep -Unhandled match case of type string -Unhandled match case of type string +UnhandledMatchError: Unhandled match case NULL +UnhandledMatchError: Unhandled match case 1 +UnhandledMatchError: Unhandled match case 5.5 +UnhandledMatchError: Unhandled match case 5.0 +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case true +UnhandledMatchError: Unhandled match case false +UnhandledMatchError: Unhandled match case of type array +UnhandledMatchError: Unhandled match case of type Beep +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type string diff --git a/Zend/tests/match/049.phpt b/Zend/tests/match/049.phpt index 2a2385f704ff..23933003d5bb 100644 --- a/Zend/tests/match/049.phpt +++ b/Zend/tests/match/049.phpt @@ -10,8 +10,8 @@ class Beep {} function test(mixed $var) { try { match($var) {}; - } catch (UnhandledMatchError $e) { - print $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,14 +29,14 @@ test(str_repeat('e', 100)); test(str_repeat("e\n", 100)); ?> --EXPECT-- -Unhandled match case of type null -Unhandled match case of type int -Unhandled match case of type float -Unhandled match case of type float -Unhandled match case of type string -Unhandled match case of type bool -Unhandled match case of type bool -Unhandled match case of type array -Unhandled match case of type Beep -Unhandled match case of type string -Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type null +UnhandledMatchError: Unhandled match case of type int +UnhandledMatchError: Unhandled match case of type float +UnhandledMatchError: Unhandled match case of type float +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type bool +UnhandledMatchError: Unhandled match case of type bool +UnhandledMatchError: Unhandled match case of type array +UnhandledMatchError: Unhandled match case of type Beep +UnhandledMatchError: Unhandled match case of type string +UnhandledMatchError: Unhandled match case of type string diff --git a/Zend/tests/match/unmatched_enum.phpt b/Zend/tests/match/unmatched_enum.phpt index 93f368a316b6..e3238f034937 100644 --- a/Zend/tests/match/unmatched_enum.phpt +++ b/Zend/tests/match/unmatched_enum.phpt @@ -12,10 +12,10 @@ try { match (Foo::Bar) { Foo::Baz => 42, }; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unhandled match case Foo::Bar +UnhandledMatchError: Unhandled match case Foo::Bar diff --git a/Zend/tests/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt index 7a8ab5a2647b..4463d97263a2 100644 --- a/Zend/tests/methods-on-non-objects-call-user-func.phpt +++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt @@ -5,9 +5,9 @@ call_user_func() in combination with "Call to a member function method() on a no $comparator = null; try { var_dump(call_user_func([$comparator, 'compare'], 1, 2)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object diff --git a/Zend/tests/methods-on-non-objects-catch.phpt b/Zend/tests/methods-on-non-objects-catch.phpt index b090437084ff..5e7c02e7a1c0 100644 --- a/Zend/tests/methods-on-non-objects-catch.phpt +++ b/Zend/tests/methods-on-non-objects-catch.phpt @@ -9,12 +9,11 @@ set_error_handler(function($code, $message) { $x= null; try { var_dump($x->method()); -} catch (Error $e) { - var_dump($e->getCode(), $e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n"; } echo "Alive\n"; ?> --EXPECTF-- -int(0) -string(%d) "Call to a member function method() on null" +Error: 0: Call to a member function method() on null Alive diff --git a/Zend/tests/methods-on-non-objects-usort.phpt b/Zend/tests/methods-on-non-objects-usort.phpt index 8a89023b7e81..5f3306d5bcea 100644 --- a/Zend/tests/methods-on-non-objects-usort.phpt +++ b/Zend/tests/methods-on-non-objects-usort.phpt @@ -11,8 +11,8 @@ $list= [1, 4, 2, 3, -1]; usort($list, function($a, $b) use ($comparator) { try { return $comparator->compare($a, $b); - } catch (Error $e) { - var_dump($e->getCode(), $e->getMessage()); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n"; return 0; } }); @@ -20,14 +20,10 @@ var_dump($list); echo "Alive\n"; ?> --EXPECT-- -int(0) -string(43) "Call to a member function compare() on null" -int(0) -string(43) "Call to a member function compare() on null" -int(0) -string(43) "Call to a member function compare() on null" -int(0) -string(43) "Call to a member function compare() on null" +Error: 0: Call to a member function compare() on null +Error: 0: Call to a member function compare() on null +Error: 0: Call to a member function compare() on null +Error: 0: Call to a member function compare() on null array(5) { [0]=> int(1) diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt index 5c543a26192c..a836044df9a1 100644 --- a/Zend/tests/mod_001.phpt +++ b/Zend/tests/mod_001.phpt @@ -9,12 +9,12 @@ $b = array(); try { $c = $a % $b; var_dump($c); -} catch (TypeError $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- -Exception: Unsupported operand types: array % array +TypeError: Unsupported operand types: array % array Done diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt index ddb657685302..fee2d0c9c627 100644 --- a/Zend/tests/mul_001.phpt +++ b/Zend/tests/mul_001.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/named_params/__invoke.phpt b/Zend/tests/named_params/__invoke.phpt index 6ebbac0f07f4..717ad657380c 100644 --- a/Zend/tests/named_params/__invoke.phpt +++ b/Zend/tests/named_params/__invoke.phpt @@ -21,8 +21,8 @@ $test(b: 'B', a: 'A'); $test(b: 'B'); try { $test(b: 'B', c: 'C'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -38,15 +38,15 @@ $test3(b: 'B', a: 'A'); $test3(b: 'B'); try { $test3(b: 'B', c: 'C'); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- a: A, b: B a: a, b: B -Unknown named parameter $c +Error: Unknown named parameter $c a: A, b: B array(1) { @@ -61,4 +61,4 @@ array(1) { a: A, b: B a: a, b: B -Unknown named parameter $c +Error: Unknown named parameter $c diff --git a/Zend/tests/named_params/assert.phpt b/Zend/tests/named_params/assert.phpt index 40a92a2f1fec..58ba7605a370 100644 --- a/Zend/tests/named_params/assert.phpt +++ b/Zend/tests/named_params/assert.phpt @@ -6,25 +6,25 @@ Calling assert with named params assert(assertion: true); try { assert(assertion: false); -} catch (AssertionError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } assert(assertion: true, description: "Description"); try { assert(assertion: false, description: "Description"); -} catch (AssertionError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(description: "Description"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(assertion: false) -Description -Named parameter $description overwrites previous argument +AssertionError: assert(assertion: false) +AssertionError: Description +Error: Named parameter $description overwrites previous argument diff --git a/Zend/tests/named_params/attributes.phpt b/Zend/tests/named_params/attributes.phpt index 94d2fad19f4d..caee975632a2 100644 --- a/Zend/tests/named_params/attributes.phpt +++ b/Zend/tests/named_params/attributes.phpt @@ -26,8 +26,8 @@ var_dump($attr->newInstance()); $attr = (new ReflectionClass(Test2::class))->getAttributes()[0]; try { var_dump($attr->newInstance()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -47,4 +47,4 @@ object(MyAttribute)#1 (3) { ["c"]=> string(1) "C" } -Named parameter $a overwrites previous argument +Error: Named parameter $a overwrites previous argument diff --git a/Zend/tests/named_params/call_user_func.phpt b/Zend/tests/named_params/call_user_func.phpt index 50f2ed588e92..74b6e6707a19 100644 --- a/Zend/tests/named_params/call_user_func.phpt +++ b/Zend/tests/named_params/call_user_func.phpt @@ -36,18 +36,18 @@ call_user_func($test_ref, ref: null); var_dump(call_user_func('call_user_func', $test, c: 'D')); try { call_user_func($test_required, b: 'B'); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(call_user_func('array_slice', [1, 2, 3, 4, 5], length: 2)); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(call_user_func('array_slice', [1, 2, 3, 4, 'x' => 5], 3, preserve_keys: true)); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -82,8 +82,8 @@ array(2) { Warning: {closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d a = a, b = b, c = D NULL -{closure:%s:%d}(): Argument #1 ($a) not passed -array_slice(): Argument #2 ($offset) not passed +ArgumentCountError: {closure:%s:%d}(): Argument #1 ($a) not passed +ArgumentCountError: array_slice(): Argument #2 ($offset) not passed array(2) { [3]=> int(4) diff --git a/Zend/tests/named_params/call_user_func_array.phpt b/Zend/tests/named_params/call_user_func_array.phpt index ebee06ea6af7..b708c63ad80c 100644 --- a/Zend/tests/named_params/call_user_func_array.phpt +++ b/Zend/tests/named_params/call_user_func_array.phpt @@ -17,13 +17,13 @@ namespace { call_user_func_array($test_variadic, ['A', 'c' => 'C']); try { call_user_func_array($test, ['d' => 'D']); - } catch (\Error $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func_array($test, ['c' => 'C', 'A']); - } catch (\Error $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; } @@ -35,13 +35,13 @@ namespace Foo { call_user_func_array($test_variadic, ['A', 'c' => 'C']); try { call_user_func_array($test, ['d' => 'D']); - } catch (\Error $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func_array($test, ['c' => 'C', 'A']); - } catch (\Error $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -56,8 +56,8 @@ array(2) { ["c"]=> string(1) "C" } -Unknown named parameter $d -Cannot use positional argument after named argument +Error: Unknown named parameter $d +Error: Cannot use positional argument after named argument a = A, b = B, c = c a = A, b = B, c = c @@ -68,5 +68,5 @@ array(2) { ["c"]=> string(1) "C" } -Unknown named parameter $d -Cannot use positional argument after named argument +Error: Unknown named parameter $d +Error: Cannot use positional argument after named argument From 430547e7d0e9b1de083466004daf9f0525010725 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:20:55 +0700 Subject: [PATCH 17/27] Zend: applied fixers to improve test robustness (part 5/8) (#23313) --- .../named_params/cannot_pass_by_ref.phpt | 6 +- .../named_params/ctor_extra_named_args.phpt | 12 +-- Zend/tests/named_params/duplicate_param.phpt | 12 +-- Zend/tests/named_params/gh17216.phpt | 6 +- Zend/tests/named_params/missing_param.phpt | 18 ++-- .../named_params/unknown_named_param.phpt | 28 +++--- Zend/tests/named_params/unpack.phpt | 24 ++--- .../named_params/unpack_and_named_1.phpt | 12 +-- Zend/tests/namespaces/ns_076.phpt | 18 ++-- Zend/tests/not_002.phpt | 6 +- Zend/tests/nullsafe_operator/001.phpt | 4 +- Zend/tests/nullsafe_operator/002.phpt | 20 ++-- Zend/tests/nullsafe_operator/003.phpt | 8 +- Zend/tests/nullsafe_operator/013.phpt | Bin 2909 -> 2938 bytes Zend/tests/nullsafe_operator/014.phpt | 10 +- Zend/tests/nullsafe_operator/016.phpt | 16 +-- Zend/tests/nullsafe_operator/026.phpt | 12 +-- Zend/tests/nullsafe_operator/033.phpt | 6 +- Zend/tests/nullsafe_operator/039.phpt | 6 +- .../constant_propagation.phpt | 6 +- ...c_string_must_generate_warning_assign.phpt | 82 +++++++-------- ...numeric_strings_must_generate_warning.phpt | 94 +++++++++--------- Zend/tests/numeric_strings/string_offset.phpt | 20 ++-- Zend/tests/offset_array.phpt | 12 +-- Zend/tests/offset_string.phpt | 30 +++--- Zend/tests/offsets/appending_containers.phpt | 18 ++-- Zend/tests/oss_fuzz_434346548.phpt | 6 +- Zend/tests/pipe_operator/ast.phpt | 78 +++++++-------- Zend/tests/pipe_operator/call_by_ref.phpt | 12 +-- .../pipe_operator/call_prefer_by_ref.phpt | 4 +- .../pipe_operator/oss_fuzz_427814452.phpt | 18 ++-- Zend/tests/pipe_operator/prec_005.phpt | 6 +- Zend/tests/pow_array_leak.phpt | 12 +-- Zend/tests/prop_const_expr/non_enums_rhs.phpt | 8 +- ..._access_errors_for_guarded_properties.phpt | 18 ++-- Zend/tests/property_exists_basic.phpt | 30 +++--- Zend/tests/property_hooks/ast_printing.phpt | 6 +- .../backed_delegated_read_write.phpt | 12 +-- Zend/tests/property_hooks/bug001.phpt | 6 +- Zend/tests/property_hooks/cache.phpt | 16 +-- .../default_value_inheritance.phpt | 14 +-- .../property_hooks/direct_hook_call.phpt | 12 +-- .../final_prop_promoted_ast.phpt | 6 +- .../property_hooks/foreach_val_to_ref.phpt | 6 +- Zend/tests/property_hooks/get.phpt | 6 +- Zend/tests/property_hooks/get_by_ref.phpt | 12 +-- .../tests/property_hooks/get_by_ref_auto.phpt | 8 +- Zend/tests/property_hooks/get_type_check.phpt | 6 +- Zend/tests/property_hooks/gh15187_3.phpt | 6 +- Zend/tests/property_hooks/gh15644.phpt | 12 +-- Zend/tests/property_hooks/gh16185_002.phpt | 6 +- Zend/tests/property_hooks/gh17101.phpt | 6 +- Zend/tests/property_hooks/gh20270.phpt | 12 +-- .../property_hooks/indirect_modification.phpt | 12 +-- .../property_hooks/magic_interaction.phpt | 18 ++-- .../property_hooks/override_add_get.phpt | 6 +- .../property_hooks/override_add_set.phpt | 6 +- .../parent_get_in_class_with_no_parent.phpt | 6 +- .../parent_get_plain_typed_uninitialized.phpt | 6 +- .../property_hooks/parent_get_plain_zpp.phpt | 6 +- .../parent_get_undefined_property.phpt | 6 +- .../property_hooks/parent_set_plain_zpp.phpt | 6 +- .../parent_superfluous_args.phpt | 12 +-- .../parent_wrong_property_info.phpt | 6 +- .../read_sibling_backing_value.phpt | 6 +- Zend/tests/property_hooks/set.phpt | 12 +-- Zend/tests/property_hooks/unset.phpt | 6 +- .../property_hooks/virtual_read_write.phpt | 12 +-- Zend/tests/readonly_classes/gh10377.phpt | 10 +- .../readonly_class_dynamic_property.phpt | 6 +- .../readonly_class_property1.phpt | 6 +- .../readonly_class_property2.phpt | 6 +- .../readonly_class_unserialize_error.phpt | 6 +- .../array_append_initialization.phpt | 12 +-- Zend/tests/readonly_props/by_ref_foreach.phpt | 6 +- Zend/tests/readonly_props/cache_slot.phpt | 30 +++--- Zend/tests/readonly_props/gh7942.phpt | 6 +- .../readonly_props/initialization_scope.phpt | 6 +- Zend/tests/readonly_props/magic_get_set.phpt | 22 ++-- Zend/tests/readonly_props/promotion.phpt | 6 +- .../readonly_assign_no_sideeffect.phpt | 6 +- .../readonly_props/readonly_clone_error1.phpt | 6 +- .../readonly_props/readonly_clone_error2.phpt | 12 +-- .../readonly_props/readonly_clone_error3.phpt | 12 +-- .../readonly_props/readonly_clone_error4.phpt | 12 +-- .../readonly_props/readonly_clone_error5.phpt | 24 ++--- 86 files changed, 575 insertions(+), 575 deletions(-) diff --git a/Zend/tests/named_params/cannot_pass_by_ref.phpt b/Zend/tests/named_params/cannot_pass_by_ref.phpt index a910cd4410c4..dab88481d7ea 100644 --- a/Zend/tests/named_params/cannot_pass_by_ref.phpt +++ b/Zend/tests/named_params/cannot_pass_by_ref.phpt @@ -5,9 +5,9 @@ Cannot pass by reference error with named parameters function test($a, &$e) {} try { test(e: 42); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -test(): Argument #2 ($e) could not be passed by reference +Error: test(): Argument #2 ($e) could not be passed by reference diff --git a/Zend/tests/named_params/ctor_extra_named_args.phpt b/Zend/tests/named_params/ctor_extra_named_args.phpt index ae569ea65d39..4617a21192a4 100644 --- a/Zend/tests/named_params/ctor_extra_named_args.phpt +++ b/Zend/tests/named_params/ctor_extra_named_args.phpt @@ -7,17 +7,17 @@ class Test {} try { new stdClass(x: "nope"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new Test(x: "nope"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unknown named parameter $x -Unknown named parameter $x +Error: Unknown named parameter $x +Error: Unknown named parameter $x diff --git a/Zend/tests/named_params/duplicate_param.phpt b/Zend/tests/named_params/duplicate_param.phpt index 6abc95bba0fb..00f67d4ea1e8 100644 --- a/Zend/tests/named_params/duplicate_param.phpt +++ b/Zend/tests/named_params/duplicate_param.phpt @@ -7,17 +7,17 @@ function test($a) {} try { test(a: 1, a: 2); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(1, a: 2); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Named parameter $a overwrites previous argument -Named parameter $a overwrites previous argument +Error: Named parameter $a overwrites previous argument +Error: Named parameter $a overwrites previous argument diff --git a/Zend/tests/named_params/gh17216.phpt b/Zend/tests/named_params/gh17216.phpt index 4cb4df0ec431..aaaa5c5dce92 100644 --- a/Zend/tests/named_params/gh17216.phpt +++ b/Zend/tests/named_params/gh17216.phpt @@ -12,11 +12,11 @@ $callback = [$o, 'trampoline']; $array = ["a" => "b", 1]; try { forward_static_call_array($callback, $array); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECT-- -Cannot use positional argument after named argument +Error: Cannot use positional argument after named argument Done diff --git a/Zend/tests/named_params/missing_param.phpt b/Zend/tests/named_params/missing_param.phpt index f8b0b356ceeb..17e2f33c67f4 100644 --- a/Zend/tests/named_params/missing_param.phpt +++ b/Zend/tests/named_params/missing_param.phpt @@ -8,20 +8,20 @@ function test($a, $b, $c, $d) { try { test(a: 'a', d: 'd'); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_keys(strict: true); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { array_keys([], strict: true); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // This works fine, as search_value is explicitly specified. @@ -29,9 +29,9 @@ var_dump(array_keys([41, 42], filter_value: 42, strict: true)); ?> --EXPECT-- -test(): Argument #2 ($b) not passed -array_keys(): Argument #1 ($array) not passed -array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known +ArgumentCountError: test(): Argument #2 ($b) not passed +ArgumentCountError: array_keys(): Argument #1 ($array) not passed +ArgumentCountError: array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known array(1) { [0]=> int(1) diff --git a/Zend/tests/named_params/unknown_named_param.phpt b/Zend/tests/named_params/unknown_named_param.phpt index 5a18932ffd17..631776efeba1 100644 --- a/Zend/tests/named_params/unknown_named_param.phpt +++ b/Zend/tests/named_params/unknown_named_param.phpt @@ -11,37 +11,37 @@ function test2(...$a) { try { test(b: 42); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(b: new stdClass); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(b: 2, a: 1); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(...new ArrayIterator(['unknown' => 42])); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(a: 42); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unknown named parameter $b -Unknown named parameter $b -Unknown named parameter $b -Unknown named parameter $unknown +Error: Unknown named parameter $b +Error: Unknown named parameter $b +Error: Unknown named parameter $b +Error: Unknown named parameter $unknown diff --git a/Zend/tests/named_params/unpack.phpt b/Zend/tests/named_params/unpack.phpt index 92bb4792c3e5..c4eeffb9428f 100644 --- a/Zend/tests/named_params/unpack.phpt +++ b/Zend/tests/named_params/unpack.phpt @@ -17,14 +17,14 @@ test(...['a', 'b' => 'b', 'c' => 'c']); try { test(...['a', 'b' => 'b', 'c']); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(...['a', 'a' => 'a']); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ary = ['b' => 0]; @@ -38,14 +38,14 @@ test(...new ArrayIterator(['a', 'b' => 'b', 'c' => 'c'])); try { test(...new ArrayIterator(['a', 'b' => 'b', 'c'])); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(...new ArrayIterator(['a', 'a' => 'a'])); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ary = ['b' => 0]; @@ -58,8 +58,8 @@ var_dump($ary, $ary2); a = a, b = b, c = c a = a, b = b, c = c a = a, b = b, c = c -Cannot use positional argument after named argument during unpacking -Named parameter $a overwrites previous argument +Error: Cannot use positional argument after named argument during unpacking +Error: Named parameter $a overwrites previous argument array(1) { ["b"]=> int(1) @@ -71,8 +71,8 @@ array(1) { a = a, b = b, c = c a = a, b = b, c = c a = a, b = b, c = c -Cannot use positional argument after named argument during unpacking -Named parameter $a overwrites previous argument +Error: Cannot use positional argument after named argument during unpacking +Error: Named parameter $a overwrites previous argument Warning: Cannot pass by-reference argument 2 of test2() by unpacking a Traversable, passing by-value instead in %s on line %d array(1) { diff --git a/Zend/tests/named_params/unpack_and_named_1.phpt b/Zend/tests/named_params/unpack_and_named_1.phpt index 1e08163724d4..85b407998469 100644 --- a/Zend/tests/named_params/unpack_and_named_1.phpt +++ b/Zend/tests/named_params/unpack_and_named_1.phpt @@ -19,13 +19,13 @@ test2(...['b' => 2, 'a' => 1], d: 40); try { test2(...[1, 2], b: 20); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test2(...[1, 'b' => 2], b: 20); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -54,5 +54,5 @@ int(1) int(2) int(3) int(40) -Named parameter $b overwrites previous argument -Named parameter $b overwrites previous argument +Error: Named parameter $b overwrites previous argument +Error: Named parameter $b overwrites previous argument diff --git a/Zend/tests/namespaces/ns_076.phpt b/Zend/tests/namespaces/ns_076.phpt index 230b498b54ac..c033f43a38ed 100644 --- a/Zend/tests/namespaces/ns_076.phpt +++ b/Zend/tests/namespaces/ns_076.phpt @@ -7,24 +7,24 @@ use Error; try { $a = array(unknown => unknown); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo unknown; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo \unknown; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "foo\unknown" -Undefined constant "foo\unknown" -Undefined constant "unknown" +Error: Undefined constant "foo\unknown" +Error: Undefined constant "foo\unknown" +Error: Undefined constant "unknown" diff --git a/Zend/tests/not_002.phpt b/Zend/tests/not_002.phpt index 3282053b6b9d..9027b8d28e82 100644 --- a/Zend/tests/not_002.phpt +++ b/Zend/tests/not_002.phpt @@ -8,8 +8,8 @@ $b = array(1,2); try { var_dump(~$b); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $a = ~$b; @@ -18,7 +18,7 @@ var_dump($a); echo "Done\n"; ?> --EXPECTF-- -Exception: Cannot perform bitwise not on array +TypeError: Cannot perform bitwise not on array Fatal error: Uncaught TypeError: Cannot perform bitwise not on array in %s:%d Stack trace: diff --git a/Zend/tests/nullsafe_operator/001.phpt b/Zend/tests/nullsafe_operator/001.phpt index 22776006a717..8e0affeb3ec4 100644 --- a/Zend/tests/nullsafe_operator/001.phpt +++ b/Zend/tests/nullsafe_operator/001.phpt @@ -45,7 +45,7 @@ var_dump($foo->self(null?->bar())->null()); try { var_dump($foo?->self()[null?->bar()]); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -103,4 +103,4 @@ string(11) "Foo::self()" string(11) "Foo::null()" NULL string(11) "Foo::self()" -string(38) "Cannot use object of type Foo as array" +Error: Cannot use object of type Foo as array diff --git a/Zend/tests/nullsafe_operator/002.phpt b/Zend/tests/nullsafe_operator/002.phpt index 87642bdcb5f0..19439bdd892d 100644 --- a/Zend/tests/nullsafe_operator/002.phpt +++ b/Zend/tests/nullsafe_operator/002.phpt @@ -6,37 +6,37 @@ Test nullsafe strict type check try { false?->bar(); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { []?->bar(); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (0)?->bar(); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (0.0)?->bar(); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ''?->bar(); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(40) "Call to a member function bar() on false" -string(40) "Call to a member function bar() on array" -string(38) "Call to a member function bar() on int" -string(40) "Call to a member function bar() on float" -string(41) "Call to a member function bar() on string" +Error: Call to a member function bar() on false +Error: Call to a member function bar() on array +Error: Call to a member function bar() on int +Error: Call to a member function bar() on float +Error: Call to a member function bar() on string diff --git a/Zend/tests/nullsafe_operator/003.phpt b/Zend/tests/nullsafe_operator/003.phpt index 83c2863d1a10..4164ffab9f97 100644 --- a/Zend/tests/nullsafe_operator/003.phpt +++ b/Zend/tests/nullsafe_operator/003.phpt @@ -25,7 +25,7 @@ var_dump($foo?->qux()); try { var_dump($foo?->quux()); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump((new Foo)?->bar); @@ -34,7 +34,7 @@ var_dump((new Foo)?->qux()); try { var_dump((new Foo)?->quux()); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -48,10 +48,10 @@ string(3) "bar" Warning: Undefined property: Foo::$baz in %s.php on line 20 NULL string(3) "qux" -string(36) "Call to undefined method Foo::quux()" +Error: Call to undefined method Foo::quux() string(3) "bar" Warning: Undefined property: Foo::$baz in %s.php on line 29 NULL string(3) "qux" -string(36) "Call to undefined method Foo::quux()" +Error: Call to undefined method Foo::quux() diff --git a/Zend/tests/nullsafe_operator/013.phpt b/Zend/tests/nullsafe_operator/013.phpt index ea35399548916013c54daecbfe675abdff91deaa..775397a941ad9849416ea9aefd85db86ae00efac 100644 GIT binary patch delta 254 zcmcaB_DgKSUY*qBjC=)^R4c3GoW$Z{9R+nO1$7;ufUaG7YKd=ZadBdLs)nYHf>KPL z(#Gqv*|xBCigRmO`go|%Z)C^%wfTUB&IOglfzY%%dsfEG&eP`#5un- zuLNR(!sIy|=6YPkB}JKe=^7@Q3QB&VK0ZoVm8O;ECCBHL=1#WZ)WKnx38x9Fy=9!P UoA+>fGIApvtuR@T+l!G402g~xwg3PC delta 216 zcmew*c2{h|Ua7LgqWF~3+yV`iR9(CD)Dqv+;^M^gR1HndjW1`j@f4R7W#*-8SXyW* zC{6BXPvTSJf(n_NLxhwj%X4TWgv~5L!eJb)2q9BbkkAGWb9uOC6QGD+sE-d^z|;t& ohL_U>NgG%w3|RgetMessage() . "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -40,8 +40,8 @@ bar int(0) bar int(0) -Call to a member function null() on null -Call to a member function null() on null +Error: Call to a member function null() on null +Error: Call to a member function null() on null bar bar -Call to a member function baz() on int +Error: Call to a member function baz() on int diff --git a/Zend/tests/nullsafe_operator/016.phpt b/Zend/tests/nullsafe_operator/016.phpt index 5bc8516ae4b9..23149c4070ac 100644 --- a/Zend/tests/nullsafe_operator/016.phpt +++ b/Zend/tests/nullsafe_operator/016.phpt @@ -14,13 +14,13 @@ function set(&$ref, $value) { function test($foo) { try { set($foo?->bar, 'bar'); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { (strrev('tes'))($foo?->bar, 'bar2'); - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,7 +29,7 @@ test(new Foo()); ?> --EXPECT-- -set(): Argument #1 ($ref) could not be passed by reference -set(): Argument #1 ($ref) could not be passed by reference -set(): Argument #1 ($ref) could not be passed by reference -set(): Argument #1 ($ref) could not be passed by reference +Error: set(): Argument #1 ($ref) could not be passed by reference +Error: set(): Argument #1 ($ref) could not be passed by reference +Error: set(): Argument #1 ($ref) could not be passed by reference +Error: set(): Argument #1 ($ref) could not be passed by reference diff --git a/Zend/tests/nullsafe_operator/026.phpt b/Zend/tests/nullsafe_operator/026.phpt index c4e825febbc5..cd2ed06884b2 100644 --- a/Zend/tests/nullsafe_operator/026.phpt +++ b/Zend/tests/nullsafe_operator/026.phpt @@ -10,17 +10,17 @@ $null = null; try { Test::${$null?->foo}->bar; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Test::{$null?->foo}()->bar; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Access to undeclared static property Test::$ -Method name must be a string +Error: Access to undeclared static property Test::$ +Error: Method name must be a string diff --git a/Zend/tests/nullsafe_operator/033.phpt b/Zend/tests/nullsafe_operator/033.phpt index 63ee2f850a56..58579d325e04 100644 --- a/Zend/tests/nullsafe_operator/033.phpt +++ b/Zend/tests/nullsafe_operator/033.phpt @@ -25,7 +25,7 @@ var_dump("{$foo?->qux()}"); try { var_dump("{$foo?->quux()}"); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump("$foo?->bar"); @@ -34,7 +34,7 @@ var_dump("$foo?->qux()"); try { var_dump("$foo?->quux()"); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -48,7 +48,7 @@ string(3) "bar" Warning: Undefined property: Foo::$baz in %s.php on line 20 string(0) "" string(3) "qux" -string(36) "Call to undefined method Foo::quux()" +Error: Call to undefined method Foo::quux() string(3) "bar" Warning: Undefined property: Foo::$baz in %s.php on line 29 diff --git a/Zend/tests/nullsafe_operator/039.phpt b/Zend/tests/nullsafe_operator/039.phpt index 92983c1592e0..4189b85dfea4 100644 --- a/Zend/tests/nullsafe_operator/039.phpt +++ b/Zend/tests/nullsafe_operator/039.phpt @@ -9,10 +9,10 @@ set_error_handler(function($_, $m) { try { $foo?->foo; -} 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/nullsafe_operator/constant_propagation.phpt b/Zend/tests/nullsafe_operator/constant_propagation.phpt index e41201d0e496..f6f9b616d7c0 100644 --- a/Zend/tests/nullsafe_operator/constant_propagation.phpt +++ b/Zend/tests/nullsafe_operator/constant_propagation.phpt @@ -7,10 +7,10 @@ class Bar { const FOO = "foo"; } try { Bar::FOO?->length(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to a member function length() on string +Error: Call to a member function length() on string diff --git a/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt index 51df22634869..a76e26cae6dc 100644 --- a/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt +++ b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt @@ -15,8 +15,8 @@ try { $a = foxcache("dolor"); $a += "sit"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("5 amet,"); @@ -26,8 +26,8 @@ try { $a = foxcache("adipiscing"); $a -= "elit,"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("11 sed"); @@ -37,8 +37,8 @@ try { $a = foxcache("eiusmod"); $a *= "tempor"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("17 incididunt"); @@ -48,8 +48,8 @@ try { $a = foxcache("labore"); $a /= "et"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("23 dolore"); @@ -59,8 +59,8 @@ try { $a = foxcache("aliqua."); $a **= "Ut"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("31 enim"); @@ -70,8 +70,8 @@ try { $a = foxcache("minim"); $a %= "veniam,"; var_dump($a); -} catch (\TypeError $e) { - echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("41 minim"); @@ -80,8 +80,8 @@ try { var_dump($a); $a = foxcache("quis"); $a <<= "nostrud"; -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a); echo "---", PHP_EOL; @@ -92,8 +92,8 @@ try { $a = foxcache("laboris"); $a >>= "nisi"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("59 ut"); @@ -106,15 +106,15 @@ try { $a = foxcache("ex"); $a |= 73; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $a = foxcache(79); $a |= "ea"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("83 commodo"); @@ -127,15 +127,15 @@ try { $a = foxcache("Duis"); $a &= 103; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $a = foxcache(107); $a &= "aute"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; $a = foxcache("109 irure"); @@ -148,15 +148,15 @@ try { $a = foxcache("in"); $a ^= 137; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $a = foxcache(139); $a ^= "reprehenderit"; var_dump($a); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -164,35 +164,35 @@ Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(5) -Unsupported operand types: string + string +TypeError: Unsupported operand types: string + string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(-2) -Unsupported operand types: string - string +TypeError: Unsupported operand types: string - string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(143) -Unsupported operand types: string * string +TypeError: Unsupported operand types: string * string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d float(0.8947368421052632) -Unsupported operand types: string / string +TypeError: Unsupported operand types: string / string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d float(3.0910586430935376E+39) -Unsupported operand types: string ** string +TypeError: Unsupported operand types: string ** string --- Warning: A non-numeric value encountered in %s on line %d @@ -206,7 +206,7 @@ Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(%d) -Unsupported operand types: string << string +TypeError: Unsupported operand types: string << string string(4) "quis" --- @@ -214,7 +214,7 @@ Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(0) -Unsupported operand types: string >> string +TypeError: Unsupported operand types: string >> string --- Warning: A non-numeric value encountered in %s on line %d @@ -222,8 +222,8 @@ int(63) Warning: A non-numeric value encountered in %s on line %d int(71) -Unsupported operand types: string | int -Unsupported operand types: int | string +TypeError: Unsupported operand types: string | int +TypeError: Unsupported operand types: int | string --- Warning: A non-numeric value encountered in %s on line %d @@ -231,8 +231,8 @@ int(81) Warning: A non-numeric value encountered in %s on line %d int(97) -Unsupported operand types: string & int -Unsupported operand types: int & string +TypeError: Unsupported operand types: string & int +TypeError: Unsupported operand types: int & string --- Warning: A non-numeric value encountered in %s on line %d @@ -240,5 +240,5 @@ int(28) Warning: A non-numeric value encountered in %s on line %d int(252) -Unsupported operand types: string ^ int -Unsupported operand types: int ^ string +TypeError: Unsupported operand types: string ^ int +TypeError: Unsupported operand types: int ^ string diff --git a/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt index 2b76f538f46e..ff3202e2c29d 100644 --- a/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt +++ b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt @@ -6,110 +6,110 @@ Invalid numeric string TypeErrors and E_WARNINGs var_dump("2 Lorem" + "3 ipsum"); try { var_dump("dolor" + "sit"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("5 amet," - "7 consectetur"); try { var_dump("adipiscing" - "elit,"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("11 sed" * "13 do"); try { var_dump("eiusmod" * "tempor"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("17 incididunt" / "19 ut"); try { var_dump("labore" / "et"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("23 dolore" ** "29 magna"); try { var_dump("aliqua." ** "Ut"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("31 enim" % "37 ad"); try { var_dump("minim" % "veniam,"); -} catch (\TypeError $e) { - echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("41 minim" << "43 veniam,"); try { var_dump("quis" << "nostrud"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("47 exercitation" >> "53 ullamco"); try { var_dump("laboris" >> "nisi"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("59 ut" | 61); var_dump(67 | "71 aliquip"); try { var_dump("ex" | 73); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(79 | "ea"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("83 commodo" & 89); var_dump(97 & "101 consequat."); try { var_dump("Duis" & 103); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(107 & "aute"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump("109 irure" ^ 113); var_dump(127 ^ "131 dolor"); try { var_dump("in" ^ 137); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(139 ^ "reprehenderit"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump(+"149 in"); try { var_dump(+"voluptate"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "---", PHP_EOL; var_dump(-"151 velit"); try { var_dump(-"esse"); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -117,35 +117,35 @@ Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(5) -Unsupported operand types: string + string +TypeError: Unsupported operand types: string + string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(-2) -Unsupported operand types: string - string +TypeError: Unsupported operand types: string - string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(143) -Unsupported operand types: string * string +TypeError: Unsupported operand types: string * string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d float(0.8947368421052632) -Unsupported operand types: string / string +TypeError: Unsupported operand types: string / string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d float(3.0910586430935376E+39) -Unsupported operand types: string ** string +TypeError: Unsupported operand types: string ** string --- Warning: A non-numeric value encountered in %s on line %d @@ -159,14 +159,14 @@ Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(%d) -Unsupported operand types: string << string +TypeError: Unsupported operand types: string << string --- Warning: A non-numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d int(0) -Unsupported operand types: string >> string +TypeError: Unsupported operand types: string >> string --- Warning: A non-numeric value encountered in %s on line %d @@ -174,8 +174,8 @@ int(63) Warning: A non-numeric value encountered in %s on line %d int(71) -Unsupported operand types: string | int -Unsupported operand types: int | string +TypeError: Unsupported operand types: string | int +TypeError: Unsupported operand types: int | string --- Warning: A non-numeric value encountered in %s on line %d @@ -183,8 +183,8 @@ int(81) Warning: A non-numeric value encountered in %s on line %d int(97) -Unsupported operand types: string & int -Unsupported operand types: int & string +TypeError: Unsupported operand types: string & int +TypeError: Unsupported operand types: int & string --- Warning: A non-numeric value encountered in %s on line %d @@ -192,15 +192,15 @@ int(28) Warning: A non-numeric value encountered in %s on line %d int(252) -Unsupported operand types: string ^ int -Unsupported operand types: int ^ string +TypeError: Unsupported operand types: string ^ int +TypeError: Unsupported operand types: int ^ string --- Warning: A non-numeric value encountered in %s on line %d int(149) -Unsupported operand types: string * int +TypeError: Unsupported operand types: string * int --- Warning: A non-numeric value encountered in %s on line %d int(-151) -Unsupported operand types: string * int +TypeError: Unsupported operand types: string * int diff --git a/Zend/tests/numeric_strings/string_offset.phpt b/Zend/tests/numeric_strings/string_offset.phpt index 0c43bc151210..4516cb24f80a 100644 --- a/Zend/tests/numeric_strings/string_offset.phpt +++ b/Zend/tests/numeric_strings/string_offset.phpt @@ -30,8 +30,8 @@ $keys = [ foreach ($keys as $key) { try { var_dump($str[$key]); - } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -39,29 +39,29 @@ echo "Done\n"; ?> --EXPECTF-- string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string Warning: Illegal string offset "7str" in %s on line %d string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string Warning: Illegal string offset " 7str" in %s on line %d string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string Warning: Illegal string offset " 7 str" in %s on line %d string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string Warning: Illegal string offset "7 str" in %s on line %d string(1) "l" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string Warning: Illegal string offset "0xC" in %s on line %d string(1) "T" diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt index e50ffad18cb2..e58701b94eb2 100644 --- a/Zend/tests/offset_array.phpt +++ b/Zend/tests/offset_array.phpt @@ -19,15 +19,15 @@ var_dump($arr[$fp]); $obj = new stdClass; try { var_dump($arr[$obj]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $arr1 = Array(1,2,3); try { var_dump($arr[$arr1]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; @@ -50,6 +50,6 @@ int(1) Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d int(%d) -Cannot access offset of type stdClass on array -Cannot access offset of type array on array +TypeError: Cannot access offset of type stdClass on array +TypeError: Cannot access offset of type array on array Done diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt index a32a68265689..c979b5a3613b 100644 --- a/Zend/tests/offset_string.phpt +++ b/Zend/tests/offset_string.phpt @@ -10,14 +10,14 @@ var_dump($str[0.0836]); var_dump($str[NULL]); try { var_dump($str["run away"]); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str["13"]); try { var_dump($str["14.5"]); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($str["15 and then some"]); @@ -27,22 +27,22 @@ var_dump($str[FALSE]); $fp = fopen(__FILE__, "r"); try { var_dump($str[$fp]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $obj = new stdClass; try { var_dump($str[$obj]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $arr = Array(1,2,3); try { var_dump($str[$arr]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; @@ -55,9 +55,9 @@ string(1) "S" Warning: String offset cast occurred in %s on line %d string(1) "S" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string string(1) "c" -Cannot access offset of type string on string +TypeError: Cannot access offset of type string on string Warning: Illegal string offset "15 and then some" in %s on line %d string(1) "r" @@ -67,7 +67,7 @@ string(1) "i" Warning: String offset cast occurred in %s on line %d string(1) "S" -Cannot access offset of type resource on string -Cannot access offset of type stdClass on string -Cannot access offset of type array on string +TypeError: Cannot access offset of type resource on string +TypeError: Cannot access offset of type stdClass on string +TypeError: Cannot access offset of type array on string Done diff --git a/Zend/tests/offsets/appending_containers.phpt b/Zend/tests/offsets/appending_containers.phpt index 0372c28bf184..85eb50812468 100644 --- a/Zend/tests/offsets/appending_containers.phpt +++ b/Zend/tests/offsets/appending_containers.phpt @@ -11,7 +11,7 @@ foreach ($containers as $container) { $container[] = 'value'; var_dump($container); } catch (\Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -30,26 +30,26 @@ array(1) { string(5) "value" } true container: -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array 4 container: -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array 5.5 container: -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array '10' container: -[] operator not supported for strings +Error: [] operator not supported for strings '25.5' container: -[] operator not supported for strings +Error: [] operator not supported for strings 'string' container: -[] operator not supported for strings +Error: [] operator not supported for strings [] container: array(1) { [0]=> string(5) "value" } STDERR container: -Cannot use a scalar value as an array +Error: Cannot use a scalar value as an array new stdClass() container: -Cannot use object of type stdClass as array +Error: Cannot use object of type stdClass as array new ArrayObject() container: object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> diff --git a/Zend/tests/oss_fuzz_434346548.phpt b/Zend/tests/oss_fuzz_434346548.phpt index 139e36758bc4..26f10ccb9894 100644 --- a/Zend/tests/oss_fuzz_434346548.phpt +++ b/Zend/tests/oss_fuzz_434346548.phpt @@ -13,10 +13,10 @@ function test($y = new Foo() < "") { try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Foo::__toString(): Return value must be of type string, none returned +TypeError: Foo::__toString(): Return value must be of type string, none returned diff --git a/Zend/tests/pipe_operator/ast.phpt b/Zend/tests/pipe_operator/ast.phpt index e8c088dabfdb..32e06f1ff10b 100644 --- a/Zend/tests/pipe_operator/ast.phpt +++ b/Zend/tests/pipe_operator/ast.phpt @@ -7,76 +7,76 @@ print "Concat, which binds higher\n"; try { assert(false && foo() . bar() |> baz() . quux()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && (foo() . bar()) |> baz() . quux()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && foo() . (bar() |> baz()) . quux()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && foo() . bar() |> (baz() . quux())); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && (foo() . bar() |> baz()) . quux()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && foo() . (bar() |> baz() . quux())); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } print "<, which binds lower\n"; try { assert(false && foo() < bar() |> baz()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && (foo() < bar()) |> baz()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && foo() < (bar() |> baz())); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && foo() |> bar() < baz()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && (foo() |> bar()) < baz()); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { assert(false && foo() |> (bar() < baz())); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -85,25 +85,25 @@ print "misc examples\n"; try { assert(false && foo() |> (bar() |> baz(...))); -} catch (AssertionError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- Concat, which binds higher -assert(false && foo() . bar() |> baz() . quux()) -assert(false && foo() . bar() |> baz() . quux()) -assert(false && foo() . (bar() |> baz()) . quux()) -assert(false && foo() . bar() |> baz() . quux()) -assert(false && (foo() . bar() |> baz()) . quux()) -assert(false && foo() . (bar() |> baz() . quux())) +AssertionError: assert(false && foo() . bar() |> baz() . quux()) +AssertionError: assert(false && foo() . bar() |> baz() . quux()) +AssertionError: assert(false && foo() . (bar() |> baz()) . quux()) +AssertionError: assert(false && foo() . bar() |> baz() . quux()) +AssertionError: assert(false && (foo() . bar() |> baz()) . quux()) +AssertionError: assert(false && foo() . (bar() |> baz() . quux())) <, which binds lower -assert(false && foo() < bar() |> baz()) -assert(false && (foo() < bar()) |> baz()) -assert(false && foo() < bar() |> baz()) -assert(false && foo() |> bar() < baz()) -assert(false && foo() |> bar() < baz()) -assert(false && foo() |> (bar() < baz())) +AssertionError: assert(false && foo() < bar() |> baz()) +AssertionError: assert(false && (foo() < bar()) |> baz()) +AssertionError: assert(false && foo() < bar() |> baz()) +AssertionError: assert(false && foo() |> bar() < baz()) +AssertionError: assert(false && foo() |> bar() < baz()) +AssertionError: assert(false && foo() |> (bar() < baz())) misc examples -assert(false && foo() |> (bar() |> baz(...))) +AssertionError: assert(false && foo() |> (bar() |> baz(...))) diff --git a/Zend/tests/pipe_operator/call_by_ref.phpt b/Zend/tests/pipe_operator/call_by_ref.phpt index 026089b0a654..052db32ea7b7 100644 --- a/Zend/tests/pipe_operator/call_by_ref.phpt +++ b/Zend/tests/pipe_operator/call_by_ref.phpt @@ -17,8 +17,8 @@ try { $a = 5; $res1 = $a |> _modify(...); var_dump($res1); -} catch (\Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Complex variables. @@ -26,12 +26,12 @@ try { $a = ['foo' => 'beep']; $res2 = $a |> _append(...); var_dump($res2); -} catch (\Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -_modify(): Argument #1 ($a) could not be passed by reference -_append(): Argument #1 ($a) could not be passed by reference +Error: _modify(): Argument #1 ($a) could not be passed by reference +Error: _append(): Argument #1 ($a) could not be passed by reference diff --git a/Zend/tests/pipe_operator/call_prefer_by_ref.phpt b/Zend/tests/pipe_operator/call_prefer_by_ref.phpt index 31750ac280d7..6476105fdad8 100644 --- a/Zend/tests/pipe_operator/call_prefer_by_ref.phpt +++ b/Zend/tests/pipe_operator/call_prefer_by_ref.phpt @@ -8,8 +8,8 @@ $a = ['hello', 'world']; try { $r = $a |> array_multisort(...); var_dump($r); -} catch (\Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt b/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt index 2ecfbab6348f..00c868483484 100644 --- a/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt +++ b/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt @@ -5,22 +5,22 @@ OSS-Fuzz #427814452 try { false |> assert(...); -} catch (\AssertionError $e) { - echo $e::class, ": '", $e->getMessage(), "'\n"; +} catch (\Throwable $e) { + echo $e::class, ': "', $e->getMessage(), '"', "\n"; } try { 0 |> "assert"(...); -} catch (\AssertionError $e) { - echo $e::class, ": '", $e->getMessage(), "'\n"; +} catch (\Throwable $e) { + echo $e::class, ': "', $e->getMessage(), '"', "\n"; } try { false |> ("a"."ssert")(...); -} catch (\AssertionError $e) { - echo $e::class, ": '", $e->getMessage(), "'\n"; +} catch (\Throwable $e) { + echo $e::class, ': "', $e->getMessage(), '"', "\n"; } ?> --EXPECT-- -AssertionError: '' -AssertionError: '' -AssertionError: '' +AssertionError: "" +AssertionError: "" +AssertionError: "" diff --git a/Zend/tests/pipe_operator/prec_005.phpt b/Zend/tests/pipe_operator/prec_005.phpt index 0dd262324e3d..c711393502a2 100644 --- a/Zend/tests/pipe_operator/prec_005.phpt +++ b/Zend/tests/pipe_operator/prec_005.phpt @@ -5,10 +5,10 @@ Pipe precedence 005 try { assert(false && 1 |> (fn() => 2)); -} catch (AssertionError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && 1 |> (fn() => 2)) +AssertionError: assert(false && 1 |> (fn() => 2)) diff --git a/Zend/tests/pow_array_leak.phpt b/Zend/tests/pow_array_leak.phpt index 06dce0ac6a2b..be7bf6b0638b 100644 --- a/Zend/tests/pow_array_leak.phpt +++ b/Zend/tests/pow_array_leak.phpt @@ -6,27 +6,27 @@ Memory leak on ** with result==op1 array $x = [0]; try { $x **= 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($x); $x = [0]; try { $x **= $x; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($x); ?> --EXPECT-- -Unsupported operand types: array ** int +TypeError: Unsupported operand types: array ** int array(1) { [0]=> int(0) } -Unsupported operand types: array ** array +TypeError: Unsupported operand types: array ** array array(1) { [0]=> int(0) diff --git a/Zend/tests/prop_const_expr/non_enums_rhs.phpt b/Zend/tests/prop_const_expr/non_enums_rhs.phpt index 0bffe9d8e02f..57ac29257cbb 100644 --- a/Zend/tests/prop_const_expr/non_enums_rhs.phpt +++ b/Zend/tests/prop_const_expr/non_enums_rhs.phpt @@ -12,8 +12,8 @@ function foo($prop = (new A)->prop) {} function test() { try { foo(); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -22,5 +22,5 @@ test(); ?> --EXPECT-- -Fetching properties on non-enums in constant expressions is not allowed -Fetching properties on non-enums in constant expressions is not allowed +Error: Fetching properties on non-enums in constant expressions is not allowed +Error: Fetching properties on non-enums in constant expressions is not allowed diff --git a/Zend/tests/property_access_errors_for_guarded_properties.phpt b/Zend/tests/property_access_errors_for_guarded_properties.phpt index 0a360a9447d7..8cc6202097d5 100644 --- a/Zend/tests/property_access_errors_for_guarded_properties.phpt +++ b/Zend/tests/property_access_errors_for_guarded_properties.phpt @@ -34,22 +34,22 @@ class Test { $test = new Test; try { $test->prop = "bar"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access private property Test::$prop -Cannot access private property Test::$prop -Cannot access private property Test::$prop +Error: Cannot access private property Test::$prop +Error: Cannot access private property Test::$prop +Error: Cannot access private property Test::$prop diff --git a/Zend/tests/property_exists_basic.phpt b/Zend/tests/property_exists_basic.phpt index 8412699e026b..4ef9358e9864 100644 --- a/Zend/tests/property_exists_basic.phpt +++ b/Zend/tests/property_exists_basic.phpt @@ -42,28 +42,28 @@ var_dump(property_exists($foo,"")); try { var_dump(property_exists(array(), "test")); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(property_exists(1, "test")); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(property_exists(3.14, "test")); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(property_exists(true, "test")); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(property_exists(null, "test")); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->bar(); @@ -86,11 +86,11 @@ bool(true) bool(true) bool(false) bool(false) -property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given -property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given -property_exists(): Argument #1 ($object_or_class) must be of type object|string, float given -property_exists(): Argument #1 ($object_or_class) must be of type object|string, true given -property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given +TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given +TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given +TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, float given +TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, true given +TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given bool(true) bool(true) bool(true) diff --git a/Zend/tests/property_hooks/ast_printing.phpt b/Zend/tests/property_hooks/ast_printing.phpt index 128a84964016..9153f4996210 100644 --- a/Zend/tests/property_hooks/ast_printing.phpt +++ b/Zend/tests/property_hooks/ast_printing.phpt @@ -19,13 +19,13 @@ try { get => 42; } }); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && new class { +AssertionError: assert(false && new class { public $prop1 { get; set; diff --git a/Zend/tests/property_hooks/backed_delegated_read_write.phpt b/Zend/tests/property_hooks/backed_delegated_read_write.phpt index df85768fe516..63910574bf75 100644 --- a/Zend/tests/property_hooks/backed_delegated_read_write.phpt +++ b/Zend/tests/property_hooks/backed_delegated_read_write.phpt @@ -45,14 +45,14 @@ $test = new Test; try { $test->prop = 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $child = new Child(); @@ -61,6 +61,6 @@ var_dump($child->prop2); ?> --EXPECTF-- -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? int(43) diff --git a/Zend/tests/property_hooks/bug001.phpt b/Zend/tests/property_hooks/bug001.phpt index 62291019b333..280f2a0791b9 100644 --- a/Zend/tests/property_hooks/bug001.phpt +++ b/Zend/tests/property_hooks/bug001.phpt @@ -20,11 +20,11 @@ $c = new C; try { $c->x = 3; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -Cannot write to get-only virtual property C::$x +Error: Cannot write to get-only virtual property C::$x diff --git a/Zend/tests/property_hooks/cache.phpt b/Zend/tests/property_hooks/cache.phpt index dedbfa48f4ac..0409c92a2b13 100644 --- a/Zend/tests/property_hooks/cache.phpt +++ b/Zend/tests/property_hooks/cache.phpt @@ -18,15 +18,15 @@ function doTest(Test $test) { $test->prop = []; try { $test->prop[] = 1; - } catch (\Error $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } isset($test->prop); isset($test->prop[0]); try { unset($test->prop); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -46,10 +46,10 @@ Test::$prop::get Test::$prop::set Test::$prop::set Test::$prop::get -Indirect modification of Test::$prop is not allowed +Error: Indirect modification of Test::$prop is not allowed Test::$prop::get Test::$prop::get -Cannot unset hooked property Test::$prop +Error: Cannot unset hooked property Test::$prop Test::$prop::set Test::$prop::get @@ -58,7 +58,7 @@ Test::$prop::get Test::$prop::set Test::$prop::set Test::$prop::get -Indirect modification of Test::$prop is not allowed +Error: Indirect modification of Test::$prop is not allowed Test::$prop::get Test::$prop::get -Cannot unset hooked property Test::$prop +Error: Cannot unset hooked property Test::$prop diff --git a/Zend/tests/property_hooks/default_value_inheritance.phpt b/Zend/tests/property_hooks/default_value_inheritance.phpt index 3821e19634e7..81fc5d2d0ace 100644 --- a/Zend/tests/property_hooks/default_value_inheritance.phpt +++ b/Zend/tests/property_hooks/default_value_inheritance.phpt @@ -28,14 +28,14 @@ function test(P $p) { var_dump($p->a); try { var_dump($p->b); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($p->c); try { var_dump($p->d); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -45,10 +45,10 @@ test(new GC); ?> --EXPECT-- NULL -Typed property C::$b must not be accessed before initialization +Error: Typed property C::$b must not be accessed before initialization int(2) int(2) NULL -Typed property GC::$b must not be accessed before initialization +Error: Typed property GC::$b must not be accessed before initialization NULL -Typed property GC::$d must not be accessed before initialization +Error: Typed property GC::$d must not be accessed before initialization diff --git a/Zend/tests/property_hooks/direct_hook_call.phpt b/Zend/tests/property_hooks/direct_hook_call.phpt index d97ef4c469a4..6a09bb115e51 100644 --- a/Zend/tests/property_hooks/direct_hook_call.phpt +++ b/Zend/tests/property_hooks/direct_hook_call.phpt @@ -13,16 +13,16 @@ class Test { $test = new Test; try { $test->{'$prop::get'}(); -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->{'$prop::set'}('foo'); -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to undefined method Test::$prop::get() -Call to undefined method Test::$prop::set() +Error: Call to undefined method Test::$prop::get() +Error: Call to undefined method Test::$prop::set() diff --git a/Zend/tests/property_hooks/final_prop_promoted_ast.phpt b/Zend/tests/property_hooks/final_prop_promoted_ast.phpt index 32aa1f27dc32..a442c879dc26 100644 --- a/Zend/tests/property_hooks/final_prop_promoted_ast.phpt +++ b/Zend/tests/property_hooks/final_prop_promoted_ast.phpt @@ -6,12 +6,12 @@ try { assert(false && new class { public function __construct(public final $prop) {} }); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && new class { +AssertionError: assert(false && new class { public function __construct(public final $prop) { } diff --git a/Zend/tests/property_hooks/foreach_val_to_ref.phpt b/Zend/tests/property_hooks/foreach_val_to_ref.phpt index dba71412579f..a5a64c0950ba 100644 --- a/Zend/tests/property_hooks/foreach_val_to_ref.phpt +++ b/Zend/tests/property_hooks/foreach_val_to_ref.phpt @@ -24,11 +24,11 @@ function test($object) { try { test(new ByVal); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(42) -Cannot create reference to property ByVal::$byVal +Error: Cannot create reference to property ByVal::$byVal diff --git a/Zend/tests/property_hooks/get.phpt b/Zend/tests/property_hooks/get.phpt index 6d4b005843ea..7c4923c86452 100644 --- a/Zend/tests/property_hooks/get.phpt +++ b/Zend/tests/property_hooks/get.phpt @@ -14,11 +14,11 @@ var_dump($test->prop); try { $test->prop = 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(42) -Cannot write to get-only virtual property Test::$prop +Error: Cannot write to get-only virtual property Test::$prop diff --git a/Zend/tests/property_hooks/get_by_ref.phpt b/Zend/tests/property_hooks/get_by_ref.phpt index f602721a791d..b35be8751bfa 100644 --- a/Zend/tests/property_hooks/get_by_ref.phpt +++ b/Zend/tests/property_hooks/get_by_ref.phpt @@ -15,20 +15,20 @@ $test = new Test; try { $test->byVal = []; $test->byVal[] = 42; -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->byVal); try { $test->byVal =& $ref; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Indirect modification of Test::$byVal is not allowed +Error: Indirect modification of Test::$byVal is not allowed array(0) { } -Cannot assign by reference to overloaded object +Error: Cannot assign by reference to overloaded object diff --git a/Zend/tests/property_hooks/get_by_ref_auto.phpt b/Zend/tests/property_hooks/get_by_ref_auto.phpt index 0dabe4c45211..7e0be4e38d92 100644 --- a/Zend/tests/property_hooks/get_by_ref_auto.phpt +++ b/Zend/tests/property_hooks/get_by_ref_auto.phpt @@ -11,15 +11,15 @@ $test = new Test; try { $test->byVal[] = 42; -} catch (\Error $e) { - echo get_class($e) . ': ' . $e->getMessage() . "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->byVal); try { $test->byVal =& $ref; -} catch (Error $e) { - echo get_class($e) . ': ' . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/property_hooks/get_type_check.phpt b/Zend/tests/property_hooks/get_type_check.phpt index 2e0e9b9fcf6e..0302e3aa7694 100644 --- a/Zend/tests/property_hooks/get_type_check.phpt +++ b/Zend/tests/property_hooks/get_type_check.phpt @@ -15,12 +15,12 @@ class Test { $test = new Test; try { var_dump($test->prop1); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop2); ?> --EXPECT-- -Test::$prop1::get(): Return value must be of type int, string returned +TypeError: Test::$prop1::get(): Return value must be of type int, string returned int(42) diff --git a/Zend/tests/property_hooks/gh15187_3.phpt b/Zend/tests/property_hooks/gh15187_3.phpt index d82e6002f82b..c8d8131de8a1 100644 --- a/Zend/tests/property_hooks/gh15187_3.phpt +++ b/Zend/tests/property_hooks/gh15187_3.phpt @@ -17,8 +17,8 @@ foreach ($c as $k => &$v) { if ($k === 'c') { try { $v = 'foo'; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } if ($k === 'd') { @@ -31,7 +31,7 @@ var_dump($c); ?> --EXPECTF-- int(1) -Cannot assign string to reference held by property C::$c of type int +TypeError: Cannot assign string to reference held by property C::$c of type int int(2) object(C)#%d (2) { ["b"]=> diff --git a/Zend/tests/property_hooks/gh15644.phpt b/Zend/tests/property_hooks/gh15644.phpt index 1e0dda3a0e44..136fc8cc587c 100644 --- a/Zend/tests/property_hooks/gh15644.phpt +++ b/Zend/tests/property_hooks/gh15644.phpt @@ -16,17 +16,17 @@ $c = new C(); try { $c->prop1 = 'hello world'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $c->prop2 = 'hello world'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify private(set) property C::$prop1 from global scope -Cannot modify private(set) property C::$prop2 from global scope +Error: Cannot modify private(set) property C::$prop1 from global scope +Error: Cannot modify private(set) property C::$prop2 from global scope diff --git a/Zend/tests/property_hooks/gh16185_002.phpt b/Zend/tests/property_hooks/gh16185_002.phpt index 39edba438b04..3154873a0620 100644 --- a/Zend/tests/property_hooks/gh16185_002.phpt +++ b/Zend/tests/property_hooks/gh16185_002.phpt @@ -21,10 +21,10 @@ $c->init(); try { foreach ($c as &$prop) {} -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Cannot acquire reference to readonly property C::$prop +Error: Cannot acquire reference to readonly property C::$prop diff --git a/Zend/tests/property_hooks/gh17101.phpt b/Zend/tests/property_hooks/gh17101.phpt index 3ab53fb75da0..d6179f763f3e 100644 --- a/Zend/tests/property_hooks/gh17101.phpt +++ b/Zend/tests/property_hooks/gh17101.phpt @@ -7,13 +7,13 @@ try { assert(false && new class { public function __construct( #[Foo] public private(set) bool $boolVal = false { final set => $this->boolVal = 1;} ) {} }); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && new class { +AssertionError: assert(false && new class { public function __construct(#[Foo] public private(set) bool $boolVal = false { final set => $this->boolVal = 1; }) { diff --git a/Zend/tests/property_hooks/gh20270.phpt b/Zend/tests/property_hooks/gh20270.phpt index 173d21990e55..b2df80519646 100644 --- a/Zend/tests/property_hooks/gh20270.phpt +++ b/Zend/tests/property_hooks/gh20270.phpt @@ -31,21 +31,21 @@ $b = new B(); try { $b->prop1 = 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($b->prop1); try { $b->prop2 = 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($b->prop2); ?> --EXPECT-- -Unknown named parameter $unknown +Error: Unknown named parameter $unknown int(42) -Unknown named parameter $value +Error: Unknown named parameter $value int(42) diff --git a/Zend/tests/property_hooks/indirect_modification.phpt b/Zend/tests/property_hooks/indirect_modification.phpt index 2fb8bda77a24..198892adfae6 100644 --- a/Zend/tests/property_hooks/indirect_modification.phpt +++ b/Zend/tests/property_hooks/indirect_modification.phpt @@ -23,14 +23,14 @@ var_dump($test->byVal); $test->byVal = []; try { $test->byVal[] = 1; -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->byVal); try { $ref =& $test->byVal; -} catch (\Error $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ref = 42; var_dump($test->byVal); @@ -43,9 +43,9 @@ Test::$byVal::set Test::$byVal::set int(3) Test::$byVal::set -Indirect modification of Test::$byVal is not allowed +Error: Indirect modification of Test::$byVal is not allowed array(0) { } -Indirect modification of Test::$byVal is not allowed +Error: Indirect modification of Test::$byVal is not allowed array(0) { } diff --git a/Zend/tests/property_hooks/magic_interaction.phpt b/Zend/tests/property_hooks/magic_interaction.phpt index 7ea9e60f8969..b2b31750fad5 100644 --- a/Zend/tests/property_hooks/magic_interaction.phpt +++ b/Zend/tests/property_hooks/magic_interaction.phpt @@ -18,24 +18,24 @@ class B extends A { echo __METHOD__, "($name)\n"; try { $this->$name; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } public function __set($name, $value) { echo __METHOD__, "($name, $value)\n"; try { $this->$name = $value; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } public function __isset($name) { echo __METHOD__, "($name)\n"; try { var_dump(isset($this->$name)); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } public function __unset($name) { @@ -49,8 +49,8 @@ var_dump(isset($b->prop)); $b->prop = 1; try { unset($b->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -59,4 +59,4 @@ A::$prop::get A::$prop::get bool(true) A::$prop::set -Cannot unset hooked property B::$prop +Error: Cannot unset hooked property B::$prop diff --git a/Zend/tests/property_hooks/override_add_get.phpt b/Zend/tests/property_hooks/override_add_get.phpt index df2739e6086c..2848d38273d3 100644 --- a/Zend/tests/property_hooks/override_add_get.phpt +++ b/Zend/tests/property_hooks/override_add_get.phpt @@ -20,8 +20,8 @@ $a = new A; $a->prop = 1; try { var_dump($a->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $b = new B; @@ -31,7 +31,7 @@ var_dump($b->prop); ?> --EXPECT-- A::A::$prop::set -Cannot read from set-only virtual property A::$prop +Error: Cannot read from set-only virtual property A::$prop B::B::$prop::set B::B::$prop::get int(42) diff --git a/Zend/tests/property_hooks/override_add_set.phpt b/Zend/tests/property_hooks/override_add_set.phpt index e13de15f0b82..ba3c9c94127e 100644 --- a/Zend/tests/property_hooks/override_add_set.phpt +++ b/Zend/tests/property_hooks/override_add_set.phpt @@ -19,8 +19,8 @@ class B extends A { $a = new A; try { $a->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->prop); @@ -30,7 +30,7 @@ var_dump($b->prop); ?> --EXPECT-- -Cannot write to get-only virtual property A::$prop +Error: Cannot write to get-only virtual property A::$prop A::A::$prop::get int(42) B::B::$prop::set diff --git a/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt b/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt index 767e585f9199..0519b652254e 100644 --- a/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt +++ b/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt @@ -12,10 +12,10 @@ class Foo { $foo = new Foo(); try { var_dump($foo->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot use "parent" when current class scope has no parent +Error: Cannot use "parent" when current class scope has no parent diff --git a/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt b/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt index 0edd8ff074ef..0fc8fea23b48 100644 --- a/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt +++ b/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt @@ -16,10 +16,10 @@ class C extends P { $c = new C(); try { var_dump($c->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Typed property C::$prop must not be accessed before initialization +Error: Typed property C::$prop must not be accessed before initialization diff --git a/Zend/tests/property_hooks/parent_get_plain_zpp.phpt b/Zend/tests/property_hooks/parent_get_plain_zpp.phpt index 04ac779f607b..0e96f3fa99e0 100644 --- a/Zend/tests/property_hooks/parent_get_plain_zpp.phpt +++ b/Zend/tests/property_hooks/parent_get_plain_zpp.phpt @@ -18,10 +18,10 @@ class B extends A { $b = new B(); try { var_dump($b->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -A::$prop::get() expects exactly 0 arguments, 1 given +ArgumentCountError: A::$prop::get() expects exactly 0 arguments, 1 given diff --git a/Zend/tests/property_hooks/parent_get_undefined_property.phpt b/Zend/tests/property_hooks/parent_get_undefined_property.phpt index 388448963e3e..04967cbcf539 100644 --- a/Zend/tests/property_hooks/parent_get_undefined_property.phpt +++ b/Zend/tests/property_hooks/parent_get_undefined_property.phpt @@ -16,10 +16,10 @@ class C extends P { $c = new C(); try { var_dump($c->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined property P::$prop +Error: Undefined property P::$prop diff --git a/Zend/tests/property_hooks/parent_set_plain_zpp.phpt b/Zend/tests/property_hooks/parent_set_plain_zpp.phpt index aa95552af563..5a6984ae7e19 100644 --- a/Zend/tests/property_hooks/parent_set_plain_zpp.phpt +++ b/Zend/tests/property_hooks/parent_set_plain_zpp.phpt @@ -18,10 +18,10 @@ class B extends A { $b = new B(); try { $b->prop = 42; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -A::$prop::set() expects exactly 1 argument, 2 given +ArgumentCountError: A::$prop::set() expects exactly 1 argument, 2 given diff --git a/Zend/tests/property_hooks/parent_superfluous_args.phpt b/Zend/tests/property_hooks/parent_superfluous_args.phpt index 2abcd7e7d10d..38658eac96fa 100644 --- a/Zend/tests/property_hooks/parent_superfluous_args.phpt +++ b/Zend/tests/property_hooks/parent_superfluous_args.phpt @@ -34,18 +34,18 @@ var_dump($b->virtual); // Calling the implicit parent hook with extra args is not ok, since it is an internal function. try { var_dump($b->backed = 42); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($b->backed); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(42) NULL -A::$backed::set() expects exactly 1 argument, 2 given -A::$backed::get() expects exactly 0 arguments, 1 given +ArgumentCountError: A::$backed::set() expects exactly 1 argument, 2 given +ArgumentCountError: A::$backed::get() expects exactly 0 arguments, 1 given diff --git a/Zend/tests/property_hooks/parent_wrong_property_info.phpt b/Zend/tests/property_hooks/parent_wrong_property_info.phpt index c18aad7f11f9..e01e2dd719d9 100644 --- a/Zend/tests/property_hooks/parent_wrong_property_info.phpt +++ b/Zend/tests/property_hooks/parent_wrong_property_info.phpt @@ -16,10 +16,10 @@ class B extends A { $b = new B; try { var_dump($b->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot access private property A::$prop +Error: Cannot access private property A::$prop diff --git a/Zend/tests/property_hooks/read_sibling_backing_value.phpt b/Zend/tests/property_hooks/read_sibling_backing_value.phpt index 65fe28fed32c..b8e1e5671f3c 100644 --- a/Zend/tests/property_hooks/read_sibling_backing_value.phpt +++ b/Zend/tests/property_hooks/read_sibling_backing_value.phpt @@ -25,10 +25,10 @@ $test = new Test; try { var_dump($test->a); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/property_hooks/set.phpt b/Zend/tests/property_hooks/set.phpt index 2928aee6cede..147f0b0e5d2c 100644 --- a/Zend/tests/property_hooks/set.phpt +++ b/Zend/tests/property_hooks/set.phpt @@ -16,17 +16,17 @@ var_dump($test->_prop); try { var_dump($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(isset($test->prop)); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(42) -Cannot read from set-only virtual property Test::$prop -Cannot read from set-only virtual property Test::$prop +Error: Cannot read from set-only virtual property Test::$prop +Error: Cannot read from set-only virtual property Test::$prop diff --git a/Zend/tests/property_hooks/unset.phpt b/Zend/tests/property_hooks/unset.phpt index 49edd56831a0..d9b2b29fb3ce 100644 --- a/Zend/tests/property_hooks/unset.phpt +++ b/Zend/tests/property_hooks/unset.phpt @@ -18,12 +18,12 @@ $test = new Test; $test->prop = 42; try { unset($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop); ?> --EXPECT-- -Cannot unset hooked property Test::$prop +Error: Cannot unset hooked property Test::$prop int(42) diff --git a/Zend/tests/property_hooks/virtual_read_write.phpt b/Zend/tests/property_hooks/virtual_read_write.phpt index e5451ee1ceb5..61eeba0e4f8f 100644 --- a/Zend/tests/property_hooks/virtual_read_write.phpt +++ b/Zend/tests/property_hooks/virtual_read_write.phpt @@ -33,17 +33,17 @@ $test = new Test; try { $test->prop = 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/readonly_classes/gh10377.phpt b/Zend/tests/readonly_classes/gh10377.phpt index c9e902ae739d..faa4ae330bf7 100644 --- a/Zend/tests/readonly_classes/gh10377.phpt +++ b/Zend/tests/readonly_classes/gh10377.phpt @@ -20,23 +20,23 @@ $anon = new class { var_dump($readonly_anon->field); try { $readonly_anon->field = 123; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($readonly_anon->field); var_dump($anon->field); try { $anon->field = 123; -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($anon->field); ?> --EXPECT-- int(2) -Cannot modify readonly property class@anonymous::$field +Error: Cannot modify readonly property class@anonymous::$field int(2) int(2) int(123) diff --git a/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt b/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt index b4da25ab0fec..6b3234a18fe3 100644 --- a/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt +++ b/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt @@ -11,10 +11,10 @@ $foo = new Foo(); try { $foo->bar = 1; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property Foo::$bar +Error: Cannot create dynamic property Foo::$bar diff --git a/Zend/tests/readonly_classes/readonly_class_property1.phpt b/Zend/tests/readonly_classes/readonly_class_property1.phpt index 34e09eecd7fc..acd9c3e68974 100644 --- a/Zend/tests/readonly_classes/readonly_class_property1.phpt +++ b/Zend/tests/readonly_classes/readonly_class_property1.phpt @@ -16,10 +16,10 @@ $foo = new Foo(); try { $foo->bar = 2; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_classes/readonly_class_property2.phpt b/Zend/tests/readonly_classes/readonly_class_property2.phpt index 6db08f4dfb38..ad491185bd87 100644 --- a/Zend/tests/readonly_classes/readonly_class_property2.phpt +++ b/Zend/tests/readonly_classes/readonly_class_property2.phpt @@ -14,10 +14,10 @@ $foo = new Foo(1); try { $foo->bar = 2; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt b/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt index e0672e4d97f8..c8ee17cb295c 100644 --- a/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt +++ b/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt @@ -7,10 +7,10 @@ readonly class C {} try { $readonly = unserialize('O:1:"C":1:{s:1:"x";b:1;}'); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create dynamic property C::$x +Error: Cannot create dynamic property C::$x diff --git a/Zend/tests/readonly_props/array_append_initialization.phpt b/Zend/tests/readonly_props/array_append_initialization.phpt index d9b3e8c07443..19008bf29f1c 100644 --- a/Zend/tests/readonly_props/array_append_initialization.phpt +++ b/Zend/tests/readonly_props/array_append_initialization.phpt @@ -21,17 +21,17 @@ function init() { try { (new C)->init(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { init(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot indirectly modify readonly property C::$a -Cannot indirectly modify readonly property C::$a +Error: Cannot indirectly modify readonly property C::$a +Error: Cannot indirectly modify readonly property C::$a diff --git a/Zend/tests/readonly_props/by_ref_foreach.phpt b/Zend/tests/readonly_props/by_ref_foreach.phpt index dfc1d1709371..67e3d31fae8e 100644 --- a/Zend/tests/readonly_props/by_ref_foreach.phpt +++ b/Zend/tests/readonly_props/by_ref_foreach.phpt @@ -20,10 +20,10 @@ $test->init(); try { foreach ($test as &$prop) {} -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot acquire reference to readonly property Test::$prop +Error: Cannot acquire reference to readonly property Test::$prop diff --git a/Zend/tests/readonly_props/cache_slot.phpt b/Zend/tests/readonly_props/cache_slot.phpt index af7f73c36eb9..53d2bcef5873 100644 --- a/Zend/tests/readonly_props/cache_slot.phpt +++ b/Zend/tests/readonly_props/cache_slot.phpt @@ -29,8 +29,8 @@ $test->setProp("a"); var_dump($test->prop); try { $test->setProp("b"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop); echo "\n"; @@ -38,13 +38,13 @@ echo "\n"; $test = new Test; try { $test->initAndAppendProp2(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->initAndAppendProp2(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop2); echo "\n"; @@ -65,13 +65,13 @@ $appendProp2 = (function() { })->bindTo($test, Test::class); try { $appendProp2(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $appendProp2(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop2); echo "\n"; @@ -90,11 +90,11 @@ var_dump($test->prop3); ?> --EXPECTF-- string(1) "a" -Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop string(1) "a" -Cannot indirectly modify readonly property Test::$prop2 -Cannot modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot modify readonly property Test::$prop2 array(0) { } @@ -107,8 +107,8 @@ object(stdClass)#%d (1) { int(1) } -Cannot indirectly modify readonly property Test::$prop2 -Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 array(0) { } diff --git a/Zend/tests/readonly_props/gh7942.phpt b/Zend/tests/readonly_props/gh7942.phpt index 89db53439a2f..ff41043d771a 100644 --- a/Zend/tests/readonly_props/gh7942.phpt +++ b/Zend/tests/readonly_props/gh7942.phpt @@ -13,10 +13,10 @@ class Foo { try { $i = 42; new Foo($i); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$bar +Error: Cannot indirectly modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/initialization_scope.phpt b/Zend/tests/readonly_props/initialization_scope.phpt index 49a4341e138f..c694d1b7ca1c 100644 --- a/Zend/tests/readonly_props/initialization_scope.phpt +++ b/Zend/tests/readonly_props/initialization_scope.phpt @@ -19,8 +19,8 @@ class B extends A { $test = new B; try { $test->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $test->initProtected(); var_dump($test); @@ -59,7 +59,7 @@ var_dump($test); ?> --EXPECTF-- -Cannot modify protected(set) readonly property A::$prop from global scope +Error: Cannot modify protected(set) readonly property A::$prop from global scope object(B)#%d (1) { ["prop"]=> int(2) diff --git a/Zend/tests/readonly_props/magic_get_set.phpt b/Zend/tests/readonly_props/magic_get_set.phpt index ff9d7c7e3325..f734c0c8817e 100644 --- a/Zend/tests/readonly_props/magic_get_set.phpt +++ b/Zend/tests/readonly_props/magic_get_set.phpt @@ -35,18 +35,18 @@ $test = new Test; var_dump(isset($test->prop)); try { var_dump($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $test->unsetProp(); @@ -56,16 +56,16 @@ var_dump($test->prop); $test->prop = 2; try { unset($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(false) -Typed property Test::$prop must not be accessed before initialization -Cannot modify protected(set) readonly property Test::$prop from global scope -Cannot unset protected(set) readonly property Test::$prop from global scope +Error: Typed property Test::$prop must not be accessed before initialization +Error: Cannot modify protected(set) readonly property Test::$prop from global scope +Error: Cannot unset protected(set) readonly property Test::$prop from global scope Test::__isset(prop) bool(true) Test::__get(prop) diff --git a/Zend/tests/readonly_props/promotion.phpt b/Zend/tests/readonly_props/promotion.phpt index ee83246083b3..f7618b279d4d 100644 --- a/Zend/tests/readonly_props/promotion.phpt +++ b/Zend/tests/readonly_props/promotion.phpt @@ -15,8 +15,8 @@ var_dump(new Point); $point = new Point(1.0, 2.0, 3.0); try { $point->x = 4.0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($point); @@ -30,7 +30,7 @@ object(Point)#1 (3) { ["z"]=> float(0) } -Cannot modify readonly property Point::$x +Error: Cannot modify readonly property Point::$x object(Point)#1 (3) { ["x"]=> float(1) diff --git a/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt b/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt index 29218d837d7f..d39de17556a7 100644 --- a/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt +++ b/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt @@ -24,10 +24,10 @@ $foo = new Foo(""); try { $foo->write(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/readonly_clone_error1.phpt b/Zend/tests/readonly_props/readonly_clone_error1.phpt index 98829d175765..39b150991f6a 100644 --- a/Zend/tests/readonly_props/readonly_clone_error1.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error1.phpt @@ -20,8 +20,8 @@ $foo = new Foo(1); try { clone $foo; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "done"; @@ -32,5 +32,5 @@ object(Foo)#2 (1) { ["bar"]=> int(2) } -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar done diff --git a/Zend/tests/readonly_props/readonly_clone_error2.phpt b/Zend/tests/readonly_props/readonly_clone_error2.phpt index e1e42abad074..d2a8f4017559 100644 --- a/Zend/tests/readonly_props/readonly_clone_error2.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error2.phpt @@ -26,17 +26,17 @@ $foo = new Foo(1, 1); try { $foo->wrongCloneOld(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $foo->wrongCloneNew(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property Foo::$bar -Cannot modify readonly property Foo::$baz +Error: Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$baz diff --git a/Zend/tests/readonly_props/readonly_clone_error3.phpt b/Zend/tests/readonly_props/readonly_clone_error3.phpt index a51ec165c68c..e436cd18a047 100644 --- a/Zend/tests/readonly_props/readonly_clone_error3.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error3.phpt @@ -28,17 +28,17 @@ $foo = new Foo(1, 1); try { $foo->wrongCloneOld(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $foo->wrongCloneNew(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property Foo::$bar -Cannot modify readonly property Foo::$baz +Error: Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$baz diff --git a/Zend/tests/readonly_props/readonly_clone_error4.phpt b/Zend/tests/readonly_props/readonly_clone_error4.phpt index f9edcbcbaa18..7596a78e3487 100644 --- a/Zend/tests/readonly_props/readonly_clone_error4.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error4.phpt @@ -20,14 +20,14 @@ $foo = new Foo(1); try { clone $foo; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { clone $foo; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> @@ -36,9 +36,9 @@ object(Foo)#2 (1) { ["bar"]=> int(3) } -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar object(Foo)#2 (1) { ["bar"]=> int(3) } -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/readonly_clone_error5.phpt b/Zend/tests/readonly_props/readonly_clone_error5.phpt index a6a10fb8a27c..b795a1cc9aae 100644 --- a/Zend/tests/readonly_props/readonly_clone_error5.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error5.phpt @@ -34,31 +34,31 @@ class TestSetTwice { try { var_dump(clone (new TestSetOnce())); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(clone (new TestSetOnce())); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(clone (new TestSetTwice())); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(clone (new TestSetTwice())); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot indirectly modify readonly property TestSetOnce::$prop -Cannot indirectly modify readonly property TestSetOnce::$prop -Cannot indirectly modify readonly property TestSetTwice::$prop -Cannot indirectly modify readonly property TestSetTwice::$prop +Error: Cannot indirectly modify readonly property TestSetOnce::$prop +Error: Cannot indirectly modify readonly property TestSetOnce::$prop +Error: Cannot indirectly modify readonly property TestSetTwice::$prop +Error: Cannot indirectly modify readonly property TestSetTwice::$prop From d88731692f1f9c7b0785a8f1aeae99a5a647bbbf Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:22:45 +0700 Subject: [PATCH 18/27] Zend: applied fixers to improve test robustness (part 6/8) (#23314) --- .../readonly_props/readonly_clone_error6.phpt | 12 +-- .../readonly_props/readonly_clone_error7.phpt | 12 +-- .../readonly_clone_success4.phpt | 8 +- .../readonly_coercion_type_error.phpt | 6 +- .../readonly_containing_object.phpt | 18 ++-- .../readonly_props/readonly_modification.phpt | 54 +++++------ Zend/tests/readonly_props/unset.phpt | 26 +++--- .../readonly_props/visibility_change.phpt | 6 +- Zend/tests/recursive_array_comparison.phpt | 12 +-- Zend/tests/recv_init_ref_type.phpt | 6 +- .../require_once_warning_to_exception.phpt | 6 +- Zend/tests/require_parse_exception.phpt | 16 ++-- ...uired_param_after_optional_named_args.phpt | 6 +- .../restrict_globals/invalid_pass_by_ref.phpt | 12 +-- Zend/tests/return_types/028.phpt | 6 +- Zend/tests/return_types/bug70557.phpt | 6 +- .../tests/return_types/never_disallowed5.phpt | 6 +- Zend/tests/self_and.phpt | 6 +- Zend/tests/self_instanceof_outside_class.phpt | 6 +- .../self_method_or_prop_outside_class.phpt | 24 ++--- Zend/tests/self_mod.phpt | 6 +- Zend/tests/self_or.phpt | 6 +- Zend/tests/self_xor.phpt | 6 +- Zend/tests/serialize/bug64354.phpt | 6 +- Zend/tests/serialize/bug71841.phpt | 36 ++++---- Zend/tests/shift_001.phpt | 6 +- Zend/tests/shift_002.phpt | 6 +- Zend/tests/stack_limit/stack_limit_001.phpt | 18 ++-- Zend/tests/stack_limit/stack_limit_002.phpt | 18 ++-- Zend/tests/stack_limit/stack_limit_003.phpt | 18 ++-- Zend/tests/stack_limit/stack_limit_006.phpt | 18 ++-- Zend/tests/stack_limit/stack_limit_007.phpt | 6 +- Zend/tests/stack_limit/stack_limit_008.phpt | 6 +- Zend/tests/stack_limit/stack_limit_011.phpt | 6 +- Zend/tests/stack_limit/stack_limit_014.phpt | 4 +- .../static_method_non_existing_class.phpt | 6 +- .../static_variables_destructor.phpt | 6 +- ...static_variables_throwing_initializer.phpt | 6 +- Zend/tests/string_offset_as_object.phpt | 54 +++++------ Zend/tests/string_offset_errors.phpt | 18 ++-- .../strlen_deprecation_to_exception.phpt | 6 +- Zend/tests/strncasecmp_basic.phpt | 6 +- Zend/tests/strncmp_basic.phpt | 6 +- Zend/tests/sub_001.phpt | 6 +- Zend/tests/switch/bug80046.phpt | 6 +- .../temporary_cleaning_012.phpt | 6 +- Zend/tests/this-reserved/this_in_extract.phpt | 6 +- Zend/tests/throw/001.phpt | 92 +++++++++---------- Zend/tests/throw/002.phpt | 78 ++++++++-------- ...hrowing_overloaded_compound_assign_op.phpt | 12 +-- Zend/tests/traits/gh_17728.phpt | 6 +- Zend/tests/traits/trait_type_errors.phpt | 18 ++-- Zend/tests/trigger_error_basic.phpt | 12 +-- Zend/tests/try/bug70228_3.phpt | 8 +- Zend/tests/try/bug70228_4.phpt | 6 +- Zend/tests/try/bug70228_5.phpt | 6 +- Zend/tests/try/bug72213.phpt | 6 +- Zend/tests/try/bug72213_2.phpt | 6 +- Zend/tests/try/catch_finally_006.phpt | 4 +- Zend/tests/try/try_finally_002.phpt | 8 +- ...int_string_type_arg_promote_exception.phpt | 6 +- Zend/tests/type_coercion/gh22112.phpt | 12 +-- .../settype/settype_resource.phpt | 30 +++--- ...ettype_string_nan_with_error_handler2.phpt | 2 +- .../type_casts/cast_to_void_ast.phpt | 6 +- .../dnf_types/dnf_2_intersection.phpt | 12 +-- .../dnf_types/dnf_intersection_and_null.phpt | 24 ++--- .../dnf_intersection_and_single.phpt | 48 +++++----- .../type_declarations/dnf_types/gh9516.phpt | 48 +++++----- .../internal_function_strict_mode.phpt | 18 ++-- .../assigning_intersection_types.phpt | 6 +- ...icit_nullable_intersection_type_error.phpt | 6 +- .../missing_interface_intersection_type.phpt | 18 ++-- .../intersection_types/parameter.phpt | 6 +- .../intersection_types/typed_reference.phpt | 6 +- .../iterable/iterable_001.phpt | 4 +- .../iterable/iterable_003.phpt | 4 +- .../literal_types/false_no_coercion.phpt | 18 ++-- .../false_no_coercion_on_overload.phpt | 6 +- .../literal_types/true_no_coercion.phpt | 24 ++--- .../true_no_coercion_on_overload.phpt | 6 +- .../mixed_property_strict_success.phpt | 6 +- .../mixed_property_weak_success.phpt | 6 +- .../validation/mixed_return_strict_error.phpt | 6 +- .../validation/mixed_return_weak_error.phpt | 6 +- .../tests/type_declarations/scalar_basic.phpt | 56 +++++------ .../scalar_constant_defaults.phpt | 12 +-- 87 files changed, 608 insertions(+), 608 deletions(-) diff --git a/Zend/tests/readonly_props/readonly_clone_error6.phpt b/Zend/tests/readonly_props/readonly_clone_error6.phpt index 16a04d802a11..f4ed5db4bb23 100644 --- a/Zend/tests/readonly_props/readonly_clone_error6.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error6.phpt @@ -21,14 +21,14 @@ var_dump($foo); try { $foo->__clone(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $foo->__clone(); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); @@ -39,8 +39,8 @@ object(Foo)#%d (%d) { ["bar"]=> int(0) } -Cannot modify readonly property Foo::$bar -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar object(Foo)#%d (%d) { ["bar"]=> int(0) diff --git a/Zend/tests/readonly_props/readonly_clone_error7.phpt b/Zend/tests/readonly_props/readonly_clone_error7.phpt index e34ad9eb3d71..6925daf86fd9 100644 --- a/Zend/tests/readonly_props/readonly_clone_error7.phpt +++ b/Zend/tests/readonly_props/readonly_clone_error7.phpt @@ -18,16 +18,16 @@ $foo = new Foo([]); // First call fills the cache slot try { var_dump(clone $foo); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(clone $foo); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot indirectly modify readonly property Foo::$bar -Cannot indirectly modify readonly property Foo::$bar +Error: Cannot indirectly modify readonly property Foo::$bar +Error: Cannot indirectly modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/readonly_clone_success4.phpt b/Zend/tests/readonly_props/readonly_clone_success4.phpt index 40b7a29e3126..ab13e88a5c36 100644 --- a/Zend/tests/readonly_props/readonly_clone_success4.phpt +++ b/Zend/tests/readonly_props/readonly_clone_success4.phpt @@ -12,8 +12,8 @@ class Foo { { try { $this->bar = "foo"; - } catch (Error $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $this->bar = 2; @@ -27,12 +27,12 @@ var_dump(clone $foo); ?> --EXPECTF-- -Cannot assign string to property Foo::$bar of type int +TypeError: Cannot assign string to property Foo::$bar of type int object(Foo)#%d (%d) { ["bar"]=> int(2) } -Cannot assign string to property Foo::$bar of type int +TypeError: Cannot assign string to property Foo::$bar of type int object(Foo)#%d (%d) { ["bar"]=> int(2) diff --git a/Zend/tests/readonly_props/readonly_coercion_type_error.phpt b/Zend/tests/readonly_props/readonly_coercion_type_error.phpt index d41211d8e998..36ad807f2424 100644 --- a/Zend/tests/readonly_props/readonly_coercion_type_error.phpt +++ b/Zend/tests/readonly_props/readonly_coercion_type_error.phpt @@ -10,8 +10,8 @@ class Foo { $this->bar = 'bar'; try { $this->bar = 42; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -20,4 +20,4 @@ new Foo(); ?> --EXPECTF-- -Cannot modify readonly property Foo::$bar +Error: Cannot modify readonly property Foo::$bar diff --git a/Zend/tests/readonly_props/readonly_containing_object.phpt b/Zend/tests/readonly_props/readonly_containing_object.phpt index 996b0ee3d44b..bf6a88c8b30a 100644 --- a/Zend/tests/readonly_props/readonly_containing_object.phpt +++ b/Zend/tests/readonly_props/readonly_containing_object.phpt @@ -17,18 +17,18 @@ $test->prop->foo += 1; $test->prop->foo++; try { $test->prop += 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { --$test->prop; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop); @@ -44,9 +44,9 @@ var_dump($test->prop); ?> --EXPECT-- -Unsupported operand types: stdClass + int -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop +TypeError: Unsupported operand types: stdClass + int +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop object(stdClass)#2 (1) { ["foo"]=> int(3) diff --git a/Zend/tests/readonly_props/readonly_modification.phpt b/Zend/tests/readonly_props/readonly_modification.phpt index bd04a203be19..d251e5c37c9e 100644 --- a/Zend/tests/readonly_props/readonly_modification.phpt +++ b/Zend/tests/readonly_props/readonly_modification.phpt @@ -20,63 +20,63 @@ $test = new Test; var_dump($test->prop); // Read. try { $test->prop = 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop += 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ++$test->prop; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ref =& $test->prop; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop =& $ref; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { byRef($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop2); // Read. try { $test->prop2[] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2[0][] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(1) -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop -Cannot modify readonly property Test::$prop -Cannot indirectly modify readonly property Test::$prop -Cannot indirectly modify readonly property Test::$prop -Cannot indirectly modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot modify readonly property Test::$prop +Error: Cannot indirectly modify readonly property Test::$prop +Error: Cannot indirectly modify readonly property Test::$prop +Error: Cannot indirectly modify readonly property Test::$prop array(0) { } -Cannot indirectly modify readonly property Test::$prop2 -Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 +Error: Cannot indirectly modify readonly property Test::$prop2 diff --git a/Zend/tests/readonly_props/unset.phpt b/Zend/tests/readonly_props/unset.phpt index 823c021f6122..7d6db9fc5abb 100644 --- a/Zend/tests/readonly_props/unset.phpt +++ b/Zend/tests/readonly_props/unset.phpt @@ -14,8 +14,8 @@ class Test { $test = new Test(1); try { unset($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test2 { @@ -39,8 +39,8 @@ var_dump($test->prop); // Call __get. var_dump($test->prop); // Don't call __get. try { unset($test->prop); // Unset initialized, illegal. -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test3 { @@ -50,8 +50,8 @@ class Test3 { $test = new Test3; try { unset($test->prop); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class Test4 { @@ -60,8 +60,8 @@ class Test4 { public function __construct() { try { unset($this->prop); - } catch (Error $e) { - echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -74,19 +74,19 @@ $test = new Test4; var_dump($test->prop); // Don't call __get. try { unset($test->prop); -} catch (Error $e) { - echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->prop); // Still don't call __get. ?> --EXPECT-- -Cannot unset readonly property Test::$prop +Error: Cannot unset readonly property Test::$prop Test2::__get int(1) int(1) -Cannot unset readonly property Test2::$prop -Cannot unset protected(set) readonly property Test3::$prop from global scope +Error: Cannot unset readonly property Test2::$prop +Error: Cannot unset protected(set) readonly property Test3::$prop from global scope Error: Cannot unset readonly property Test4::$prop int(1) Error: Cannot unset readonly property Test4::$prop diff --git a/Zend/tests/readonly_props/visibility_change.phpt b/Zend/tests/readonly_props/visibility_change.phpt index f4a32f3cdaaf..6e06efd61e67 100644 --- a/Zend/tests/readonly_props/visibility_change.phpt +++ b/Zend/tests/readonly_props/visibility_change.phpt @@ -17,8 +17,8 @@ class B extends A { $a = new A(); try { var_dump($a->prop); -} catch (Error $error) { - echo $error->getMessage() . "\n"; +} catch (Throwable $error) { + echo $error::class, ': ', $error->getMessage(), "\n"; } $b = new B(); @@ -26,5 +26,5 @@ var_dump($b->prop); ?> --EXPECT-- -Cannot access protected property A::$prop +Error: Cannot access protected property A::$prop int(42) diff --git a/Zend/tests/recursive_array_comparison.phpt b/Zend/tests/recursive_array_comparison.phpt index 53cc9736030d..c136f400ae39 100644 --- a/Zend/tests/recursive_array_comparison.phpt +++ b/Zend/tests/recursive_array_comparison.phpt @@ -5,17 +5,17 @@ Comparison of a recursive array throws a catchable error $a = [&$a]; try { $a === [[]]; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { [[]] === $a; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a === $a); ?> --EXPECT-- -Nesting level too deep - recursive dependency? -Nesting level too deep - recursive dependency? +Error: Nesting level too deep - recursive dependency? +Error: Nesting level too deep - recursive dependency? bool(true) diff --git a/Zend/tests/recv_init_ref_type.phpt b/Zend/tests/recv_init_ref_type.phpt index 29b96d379f8d..3a72d265305f 100644 --- a/Zend/tests/recv_init_ref_type.phpt +++ b/Zend/tests/recv_init_ref_type.phpt @@ -9,10 +9,10 @@ function test(array &$foo = []) { try { $bar = 42; test($bar); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d +TypeError: test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d diff --git a/Zend/tests/require_once_warning_to_exception.phpt b/Zend/tests/require_once_warning_to_exception.phpt index bc706622438f..2eb33e035cdd 100644 --- a/Zend/tests/require_once_warning_to_exception.phpt +++ b/Zend/tests/require_once_warning_to_exception.phpt @@ -10,10 +10,10 @@ set_error_handler("exception_error_handler"); try { $results = require_once 'does-not-exist.php'; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; }; ?> --EXPECT-- -require_once(): Failed to open stream: No such file or directory +Exception: require_once(): Failed to open stream: No such file or directory diff --git a/Zend/tests/require_parse_exception.phpt b/Zend/tests/require_parse_exception.phpt index d64efe178671..331786bcaa15 100644 --- a/Zend/tests/require_parse_exception.phpt +++ b/Zend/tests/require_parse_exception.phpt @@ -8,8 +8,8 @@ allow_url_include=1 function test_parse_error($code) { try { require 'data://text/plain;base64,' . base64_encode($code); - } catch (ParseError $e) { - echo $e->getMessage(), " on line ", $e->getLine(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), ' on line ', $e->getLine(), "\n"; } } @@ -43,9 +43,9 @@ var_dump("\u{ffffff}");'); ?> --EXPECT-- Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 -Unclosed '{' on line 2 -Unclosed '{' on line 3 -syntax error, unexpected end of file, expecting "(" on line 2 -Invalid numeric literal on line 2 -Invalid UTF-8 codepoint escape sequence on line 2 -Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2 +ParseError: Unclosed '{' on line 2 +ParseError: Unclosed '{' on line 3 +ParseError: syntax error, unexpected end of file, expecting "(" on line 2 +ParseError: Invalid numeric literal on line 2 +ParseError: Invalid UTF-8 codepoint escape sequence on line 2 +ParseError: Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2 diff --git a/Zend/tests/required_param_after_optional_named_args.phpt b/Zend/tests/required_param_after_optional_named_args.phpt index 19060ab108b0..c96d51ff0083 100644 --- a/Zend/tests/required_param_after_optional_named_args.phpt +++ b/Zend/tests/required_param_after_optional_named_args.phpt @@ -7,11 +7,11 @@ function test($a = 1, $b) { } try { test(b: 2); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: test(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d -test(): Argument #1 ($a) not passed +ArgumentCountError: test(): Argument #1 ($a) not passed diff --git a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt index afb099b6812d..afa8a0e75bba 100644 --- a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt +++ b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt @@ -6,18 +6,18 @@ $GLOBALS must be passed by reference (runtime error) function by_ref(&$ref) {} try { by_ref($GLOBALS); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { by_ref2($GLOBALS); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function by_ref2(&$ref) {} ?> --EXPECT-- -by_ref(): Argument #1 ($ref) could not be passed by reference -by_ref2(): Argument #1 ($ref) could not be passed by reference +Error: by_ref(): Argument #1 ($ref) could not be passed by reference +Error: by_ref2(): Argument #1 ($ref) could not be passed by reference diff --git a/Zend/tests/return_types/028.phpt b/Zend/tests/return_types/028.phpt index 802dd7708dfe..efc356e1d10e 100644 --- a/Zend/tests/return_types/028.phpt +++ b/Zend/tests/return_types/028.phpt @@ -11,10 +11,10 @@ function foo(): stdClass { try { foo(); -} catch (Error $e) { - echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), ' on line ', $e->getLine(), "\n"; } ?> --EXPECTF-- -foo(): Return value must be of type stdClass, array returned in %s on line %d +TypeError: foo(): Return value must be of type stdClass, array returned in %s on line %d diff --git a/Zend/tests/return_types/bug70557.phpt b/Zend/tests/return_types/bug70557.phpt index 1795a2a26a79..f804678f83d8 100644 --- a/Zend/tests/return_types/bug70557.phpt +++ b/Zend/tests/return_types/bug70557.phpt @@ -9,9 +9,9 @@ function getNumber() : int { try { getNumber(); -} catch (TypeError $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(62) "getNumber(): Return value must be of type int, string returned" +TypeError: getNumber(): Return value must be of type int, string returned diff --git a/Zend/tests/return_types/never_disallowed5.phpt b/Zend/tests/return_types/never_disallowed5.phpt index 26887cd46833..c6ca9a5def02 100644 --- a/Zend/tests/return_types/never_disallowed5.phpt +++ b/Zend/tests/return_types/never_disallowed5.phpt @@ -13,9 +13,9 @@ class Foo { try { Foo::bar(); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Foo::bar(): never-returning method must not implicitly return +TypeError: Foo::bar(): never-returning method must not implicitly return diff --git a/Zend/tests/self_and.phpt b/Zend/tests/self_and.phpt index f3662c575c48..76b370a35780 100644 --- a/Zend/tests/self_and.phpt +++ b/Zend/tests/self_and.phpt @@ -15,8 +15,8 @@ var_dump($s); try { $s1 &= 11; var_dump($s1); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 &= 33; @@ -32,7 +32,7 @@ echo "Done\n"; ?> --EXPECTF-- int(18) -Unsupported operand types: string & int +TypeError: Unsupported operand types: string & int Warning: A non-numeric value encountered in %s on line %d int(33) diff --git a/Zend/tests/self_instanceof_outside_class.phpt b/Zend/tests/self_instanceof_outside_class.phpt index ecb593a6a580..ffee9a84675e 100644 --- a/Zend/tests/self_instanceof_outside_class.phpt +++ b/Zend/tests/self_instanceof_outside_class.phpt @@ -6,12 +6,12 @@ instanceof self outside a class $fn = function() { try { new stdClass instanceof self; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } }; $fn(); ?> --EXPECT-- -Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active diff --git a/Zend/tests/self_method_or_prop_outside_class.phpt b/Zend/tests/self_method_or_prop_outside_class.phpt index feaeccf25f95..c534dcf62af8 100644 --- a/Zend/tests/self_method_or_prop_outside_class.phpt +++ b/Zend/tests/self_method_or_prop_outside_class.phpt @@ -7,30 +7,30 @@ $fn = function() { $str = "foo"; try { self::${$str . "bar"}; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset(self::${$str . "bar"}); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset(self::${$str . "bar"}); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { self::{$str . "bar"}(); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } }; $fn(); ?> --EXPECT-- -Cannot access "self" when no class scope is active -Cannot access "self" when no class scope is active -Cannot access "self" when no class scope is active -Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active +Error: Cannot access "self" when no class scope is active diff --git a/Zend/tests/self_mod.phpt b/Zend/tests/self_mod.phpt index 7d469f800239..feaa34517772 100644 --- a/Zend/tests/self_mod.phpt +++ b/Zend/tests/self_mod.phpt @@ -13,8 +13,8 @@ var_dump($s); try { $s1 %= 11; var_dump($s1); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 %= 33; @@ -24,7 +24,7 @@ echo "Done\n"; ?> --EXPECTF-- int(13) -Unsupported operand types: string % int +TypeError: Unsupported operand types: string % int Warning: A non-numeric value encountered in %s on line %d int(3) diff --git a/Zend/tests/self_or.phpt b/Zend/tests/self_or.phpt index 61f1f4203b08..5ad5d8dbaee8 100644 --- a/Zend/tests/self_or.phpt +++ b/Zend/tests/self_or.phpt @@ -15,8 +15,8 @@ var_dump($s); try { $s1 |= 11; var_dump($s1); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 |= 33; @@ -32,7 +32,7 @@ echo "Done\n"; ?> --EXPECTF-- int(127) -Unsupported operand types: string | int +TypeError: Unsupported operand types: string | int Warning: A non-numeric value encountered in %s on line %d int(45345) diff --git a/Zend/tests/self_xor.phpt b/Zend/tests/self_xor.phpt index 4bff3f6d508e..8262d185f7e8 100644 --- a/Zend/tests/self_xor.phpt +++ b/Zend/tests/self_xor.phpt @@ -15,8 +15,8 @@ var_dump($s); try { $s1 ^= 11; var_dump($s1); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 ^= 33; @@ -32,7 +32,7 @@ echo "Done\n"; ?> --EXPECTF-- int(109) -Unsupported operand types: string ^ int +TypeError: Unsupported operand types: string ^ int Warning: A non-numeric value encountered in %s on line %d int(45312) diff --git a/Zend/tests/serialize/bug64354.phpt b/Zend/tests/serialize/bug64354.phpt index 11b0aa31e247..fde6dd5cc01a 100644 --- a/Zend/tests/serialize/bug64354.phpt +++ b/Zend/tests/serialize/bug64354.phpt @@ -16,10 +16,10 @@ $data = array(new B); try { serialize($data); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: B implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d -string(9) "serialize" +Exception: serialize diff --git a/Zend/tests/serialize/bug71841.phpt b/Zend/tests/serialize/bug71841.phpt index f32b0e9b231f..75b1269eb9f1 100644 --- a/Zend/tests/serialize/bug71841.phpt +++ b/Zend/tests/serialize/bug71841.phpt @@ -5,41 +5,41 @@ Bug #71841 (EG(error_zval) is not handled well) $z = unserialize('O:1:"A":0:{}'); try { var_dump($z->e.=0); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(++$z->x); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($z->y++); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $y = array(PHP_INT_MAX => 0); try { var_dump($y[] .= 0); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(++$y[]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($y[]++); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition -The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition -The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied -Cannot add element to the array as the next element is already occupied +Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition +Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition +Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied +Error: Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/shift_001.phpt b/Zend/tests/shift_001.phpt index f441cf2dcf8b..e66bb5306a30 100644 --- a/Zend/tests/shift_001.phpt +++ b/Zend/tests/shift_001.phpt @@ -13,8 +13,8 @@ var_dump($s); try { $s1 <<= 1; var_dump($s1); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 <<= 3; @@ -24,7 +24,7 @@ echo "Done\n"; ?> --EXPECTF-- int(492) -Unsupported operand types: string << int +TypeError: Unsupported operand types: string << int Warning: A non-numeric value encountered in %s on line %d int(362760) diff --git a/Zend/tests/shift_002.phpt b/Zend/tests/shift_002.phpt index 0bdc9b3eeb3c..3434c9332e6d 100644 --- a/Zend/tests/shift_002.phpt +++ b/Zend/tests/shift_002.phpt @@ -13,8 +13,8 @@ var_dump($s); try { $s1 >>= 1; var_dump($s1); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 >>= 3; @@ -24,7 +24,7 @@ echo "Done\n"; ?> --EXPECTF-- int(30) -Unsupported operand types: string >> int +TypeError: Unsupported operand types: string >> int Warning: A non-numeric value encountered in %s on line %d int(5668) diff --git a/Zend/tests/stack_limit/stack_limit_001.phpt b/Zend/tests/stack_limit/stack_limit_001.phpt index 73cc3c08fe9d..2142364de4f4 100644 --- a/Zend/tests/stack_limit/stack_limit_001.phpt +++ b/Zend/tests/stack_limit/stack_limit_001.phpt @@ -35,20 +35,20 @@ function replace() { try { new Test1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -63,6 +63,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_002.phpt b/Zend/tests/stack_limit/stack_limit_002.phpt index 64a11e1b2638..059eecb9c4f0 100644 --- a/Zend/tests/stack_limit/stack_limit_002.phpt +++ b/Zend/tests/stack_limit/stack_limit_002.phpt @@ -34,20 +34,20 @@ function replace() { $fiber = new Fiber(function (): void { try { new Test1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } }); @@ -65,6 +65,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_003.phpt b/Zend/tests/stack_limit/stack_limit_003.phpt index 9956c761cb18..1d0d7c089649 100644 --- a/Zend/tests/stack_limit/stack_limit_003.phpt +++ b/Zend/tests/stack_limit/stack_limit_003.phpt @@ -33,20 +33,20 @@ function replace() { try { new Test1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -61,6 +61,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_006.phpt b/Zend/tests/stack_limit/stack_limit_006.phpt index d8d6251cf0c6..4e187a513a3c 100644 --- a/Zend/tests/stack_limit/stack_limit_006.phpt +++ b/Zend/tests/stack_limit/stack_limit_006.phpt @@ -292,20 +292,20 @@ function replace() { try { new Test1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone new Test2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { replace(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -320,6 +320,6 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_007.phpt b/Zend/tests/stack_limit/stack_limit_007.phpt index d34e244234c2..58478cc5a1c8 100644 --- a/Zend/tests/stack_limit/stack_limit_007.phpt +++ b/Zend/tests/stack_limit/stack_limit_007.phpt @@ -18,8 +18,8 @@ function replace() { try { $tryExecuted = true; return replace(); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; // We should not enter the catch block if we haven't executed at // least one op in the try block printf("Try executed: %d\n", $tryExecuted ?? 0); @@ -41,5 +41,5 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? Try executed: 1 diff --git a/Zend/tests/stack_limit/stack_limit_008.phpt b/Zend/tests/stack_limit/stack_limit_008.phpt index db61fb15e52c..e52f2f350ad2 100644 --- a/Zend/tests/stack_limit/stack_limit_008.phpt +++ b/Zend/tests/stack_limit/stack_limit_008.phpt @@ -21,8 +21,8 @@ function replace() { echo "Will throw:\n"; try { return replace2(); - } catch (Error $e) { - echo $e->getMessage(); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } }, 'x'); @@ -55,4 +55,4 @@ array(4) { string(%d) "0x%x" } Will throw: -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_011.phpt b/Zend/tests/stack_limit/stack_limit_011.phpt index 762f67184f6a..15aa89d78c6e 100644 --- a/Zend/tests/stack_limit/stack_limit_011.phpt +++ b/Zend/tests/stack_limit/stack_limit_011.phpt @@ -34,8 +34,8 @@ function replace() { try { replace(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; echo 'Previous: ', $e->getPrevious()->getMessage(), "\n"; } @@ -51,5 +51,5 @@ array(4) { ["EG(stack_limit)"]=> string(%d) "0x%x" } -Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? +Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? Previous: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? diff --git a/Zend/tests/stack_limit/stack_limit_014.phpt b/Zend/tests/stack_limit/stack_limit_014.phpt index 144c64ad39ea..d9e87f4de790 100644 --- a/Zend/tests/stack_limit/stack_limit_014.phpt +++ b/Zend/tests/stack_limit/stack_limit_014.phpt @@ -15,8 +15,8 @@ memory_limit=1G try { require __DIR__.'/stack_limit_014.inc'; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/Zend/tests/static_method_non_existing_class.phpt b/Zend/tests/static_method_non_existing_class.phpt index 752655d22782..6917a4de3e90 100644 --- a/Zend/tests/static_method_non_existing_class.phpt +++ b/Zend/tests/static_method_non_existing_class.phpt @@ -6,10 +6,10 @@ Calling a static method on a non-existing class $str = "foo"; try { Test::{$str . "bar"}(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Class "Test" not found +Error: Class "Test" not found diff --git a/Zend/tests/static_variables/static_variables_destructor.phpt b/Zend/tests/static_variables/static_variables_destructor.phpt index 9128c86e6b1b..8377db2f74ca 100644 --- a/Zend/tests/static_variables/static_variables_destructor.phpt +++ b/Zend/tests/static_variables/static_variables_destructor.phpt @@ -24,13 +24,13 @@ function foo(bool $throw) { try { foo(true); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } foo(false); ?> --EXPECT-- bar() called -__destruct() called +Exception: __destruct() called int(42) diff --git a/Zend/tests/static_variables/static_variables_throwing_initializer.phpt b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt index 9e4752c24f5c..c5b5a1223c71 100644 --- a/Zend/tests/static_variables/static_variables_throwing_initializer.phpt +++ b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt @@ -10,12 +10,12 @@ function foo($throw) { try { var_dump(foo(true)); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(foo(false)); ?> --EXPECT-- -Throwing from foo() +Exception: Throwing from foo() int(42) diff --git a/Zend/tests/string_offset_as_object.phpt b/Zend/tests/string_offset_as_object.phpt index 6fdebe936088..f5d477ef1b3b 100644 --- a/Zend/tests/string_offset_as_object.phpt +++ b/Zend/tests/string_offset_as_object.phpt @@ -6,58 +6,58 @@ Using string offset as object $str = "x"; try { $str[0]->bar = "xyz"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar[1] = "bang"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar += 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar = &$b; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { ++$str[0]->bar; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { --$str[0]->bar; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar++; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str[0]->bar--; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($str[0]->bar); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object -Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object +Error: Cannot use string offset as an object diff --git a/Zend/tests/string_offset_errors.phpt b/Zend/tests/string_offset_errors.phpt index 726dc41f0653..60c5399f5a60 100644 --- a/Zend/tests/string_offset_errors.phpt +++ b/Zend/tests/string_offset_errors.phpt @@ -15,25 +15,25 @@ function &gen() { try { test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $str = "foo"; $str[0] =& $str[1]; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { foreach (gen() as $v) {} -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot create references to/from string offsets -Cannot create references to/from string offsets -Cannot create references to/from string offsets +Error: Cannot create references to/from string offsets +Error: Cannot create references to/from string offsets +Error: Cannot create references to/from string offsets diff --git a/Zend/tests/strlen_deprecation_to_exception.phpt b/Zend/tests/strlen_deprecation_to_exception.phpt index 7b616f3b6432..e7622db355ba 100644 --- a/Zend/tests/strlen_deprecation_to_exception.phpt +++ b/Zend/tests/strlen_deprecation_to_exception.phpt @@ -8,10 +8,10 @@ set_error_handler(function($_, $msg) { }); try { strlen(null); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -strlen(): Passing null to parameter #1 ($string) of type string is deprecated +Exception: strlen(): Passing null to parameter #1 ($string) of type string is deprecated diff --git a/Zend/tests/strncasecmp_basic.phpt b/Zend/tests/strncasecmp_basic.phpt index 54eb6fb5209b..fc150741ada3 100644 --- a/Zend/tests/strncasecmp_basic.phpt +++ b/Zend/tests/strncasecmp_basic.phpt @@ -5,8 +5,8 @@ strncasecmp() tests try { var_dump(strncasecmp("", "", -1)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(strncasecmp("aef", "dfsgbdf", 0)); @@ -19,7 +19,7 @@ var_dump(strncasecmp("01", "01", 1000)); ?> --EXPECT-- -strncasecmp(): Argument #3 ($length) must be greater than or equal to 0 +ValueError: strncasecmp(): Argument #3 ($length) must be greater than or equal to 0 int(0) int(-3) int(0) diff --git a/Zend/tests/strncmp_basic.phpt b/Zend/tests/strncmp_basic.phpt index bb40946f240a..6f93ed23f939 100644 --- a/Zend/tests/strncmp_basic.phpt +++ b/Zend/tests/strncmp_basic.phpt @@ -6,8 +6,8 @@ strncmp() tests var_dump(strncmp("", "", 100)); try { var_dump(strncmp("aef", "dfsgbdf", -1)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(strncmp("fghjkl", "qwer", 0)); var_dump(strncmp("qwerty", "qwerty123", 6)); @@ -16,7 +16,7 @@ var_dump(strncmp("qwerty", "qwerty123", 7)); ?> --EXPECT-- int(0) -strncmp(): Argument #3 ($length) must be greater than or equal to 0 +ValueError: strncmp(): Argument #3 ($length) must be greater than or equal to 0 int(0) int(0) int(-1) diff --git a/Zend/tests/sub_001.phpt b/Zend/tests/sub_001.phpt index 92e3ff0021f0..bf134a7f2366 100644 --- a/Zend/tests/sub_001.phpt +++ b/Zend/tests/sub_001.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/switch/bug80046.phpt b/Zend/tests/switch/bug80046.phpt index 87a493c20308..9964826c5eca 100644 --- a/Zend/tests/switch/bug80046.phpt +++ b/Zend/tests/switch/bug80046.phpt @@ -13,10 +13,10 @@ function test($foo) { } try { test('Foo'); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Default +Exception: Default diff --git a/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt b/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt index 95d2fc1233d4..950c092c2684 100644 --- a/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt +++ b/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt @@ -11,10 +11,10 @@ class Foo { try { Foo::test(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Access to undeclared static property Foo::$property +Error: Access to undeclared static property Foo::$property diff --git a/Zend/tests/this-reserved/this_in_extract.phpt b/Zend/tests/this-reserved/this_in_extract.phpt index 2e3f7b497fdb..5db09b7d700a 100644 --- a/Zend/tests/this-reserved/this_in_extract.phpt +++ b/Zend/tests/this-reserved/this_in_extract.phpt @@ -5,15 +5,15 @@ $this re-assign in extract() function foo() { try { extract(["this"=>42, "a"=>24]); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a); } foo(); ?> --EXPECTF-- -Cannot re-assign $this +Error: Cannot re-assign $this Warning: Undefined variable $a in %s on line %d NULL diff --git a/Zend/tests/throw/001.phpt b/Zend/tests/throw/001.phpt index ba2406c6d388..906e812d29bd 100644 --- a/Zend/tests/throw/001.phpt +++ b/Zend/tests/throw/001.phpt @@ -6,93 +6,93 @@ throw expression try { $result = true && throw new Exception("true && throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false && throw new Exception("false && throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true and throw new Exception("true and throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false and throw new Exception("false and throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true || throw new Exception("true || throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false || throw new Exception("false || throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true or throw new Exception("true or throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false or throw new Exception("false or throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = null ?? throw new Exception("null ?? throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = "foo" ?? throw new Exception('"foo" ?? throw'); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = null ?: throw new Exception("null ?: throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = "foo" ?: throw new Exception('"foo" ?: throw'); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $callable = fn() => throw new Exception("fn() => throw"); var_dump("not yet"); $callable(); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $result = "bar"; @@ -106,28 +106,28 @@ try { throw new Exception("exception 1"), throw new Exception("exception 2") ); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = true ? true : throw new Exception("true ? true : throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $result = false ? true : throw new Exception("false ? true : throw"); var_dump($result); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw new Exception() + 1; } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -143,31 +143,31 @@ var_dump($exception->getMessage()); try { throw null ?? new Exception('throw null ?? new Exception();'); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(13) "true && throw" +Exception: true && throw bool(false) -string(14) "true and throw" +Exception: true and throw bool(false) bool(true) -string(14) "false || throw" +Exception: false || throw bool(true) -string(14) "false or throw" -string(13) "null ?? throw" +Exception: false or throw +Exception: null ?? throw string(3) "foo" -string(13) "null ?: throw" +Exception: null ?: throw string(3) "foo" string(7) "not yet" -string(13) "fn() => throw" +Exception: fn() => throw string(3) "bar" -string(11) "exception 1" +Exception: exception 1 bool(true) -string(20) "false ? true : throw" -string(42) "Unsupported operand types: Exception + int" +Exception: false ? true : throw +TypeError: Unsupported operand types: Exception + int string(35) "throw $exception = new Exception();" string(37) "throw $exception ??= new Exception();" -string(30) "throw null ?? new Exception();" +Exception: throw null ?? new Exception(); diff --git a/Zend/tests/throw/002.phpt b/Zend/tests/throw/002.phpt index e80dfbb7d14d..b38bc7c717f8 100644 --- a/Zend/tests/throw/002.phpt +++ b/Zend/tests/throw/002.phpt @@ -23,62 +23,62 @@ class Foo { try { (new Foo())->throwException(); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Foo::staticThrowException(); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw true ? new Exception('Ternary true 1') : new Exception('Ternary true 2'); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw false ? new Exception('Ternary false 1') : new Exception('Ternary false 2'); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $exception1 = new Exception('Coalesce non-null 1'); $exception2 = new Exception('Coalesce non-null 2'); throw $exception1 ?? $exception2; -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $exception1 = null; $exception2 = new Exception('Coalesce null 2'); throw $exception1 ?? $exception2; -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { throw $exception = new Exception('Assignment'); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $exception = null; throw $exception ??= new Exception('Coalesce assignment null'); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $exception = new Exception('Coalesce assignment non-null 1'); throw $exception ??= new Exception('Coalesce assignment non-null 2'); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $andConditionalTest = function ($condition1, $condition2) { @@ -89,40 +89,40 @@ $andConditionalTest = function ($condition1, $condition2) { try { $andConditionalTest(false, false); -} catch(Exception $e) { - echo $e->getMessage() . "\n"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $andConditionalTest(false, true); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $andConditionalTest(true, false); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $andConditionalTest(true, true); -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not found -Static not found -Ternary true 1 -Ternary false 2 -Coalesce non-null 1 -Coalesce null 2 -Assignment -Coalesce assignment null -Coalesce assignment non-null 1 -And in conditional 2 -And in conditional 2 -And in conditional 2 -And in conditional 1 +Exception: Not found +Exception: Static not found +Exception: Ternary true 1 +Exception: Ternary false 2 +Exception: Coalesce non-null 1 +Exception: Coalesce null 2 +Exception: Assignment +Exception: Coalesce assignment null +Exception: Coalesce assignment non-null 1 +Exception: And in conditional 2 +Exception: And in conditional 2 +Exception: And in conditional 2 +Exception: And in conditional 1 diff --git a/Zend/tests/throwing_overloaded_compound_assign_op.phpt b/Zend/tests/throwing_overloaded_compound_assign_op.phpt index 39c38627076c..7f127701ee6e 100644 --- a/Zend/tests/throwing_overloaded_compound_assign_op.phpt +++ b/Zend/tests/throwing_overloaded_compound_assign_op.phpt @@ -15,22 +15,22 @@ $test = new ArrayObject; $test[0] = 42; try { $test[0] %= 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); $test2 = new Test; try { $test2->prop %= 0; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test2); ?> --EXPECT-- -Modulo by zero +DivisionByZeroError: Modulo by zero object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { @@ -38,7 +38,7 @@ object(ArrayObject)#1 (1) { int(42) } } -Modulo by zero +DivisionByZeroError: Modulo by zero object(Test)#3 (1) { ["prop"]=> int(42) diff --git a/Zend/tests/traits/gh_17728.phpt b/Zend/tests/traits/gh_17728.phpt index ef458a8e8d5e..a42231f6004d 100644 --- a/Zend/tests/traits/gh_17728.phpt +++ b/Zend/tests/traits/gh_17728.phpt @@ -15,10 +15,10 @@ trait Foo { try { Foo::bar(); -} catch (ErrorException $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait +ErrorException: Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait diff --git a/Zend/tests/traits/trait_type_errors.phpt b/Zend/tests/traits/trait_type_errors.phpt index d3c7c0582fb1..7d6a2d598026 100644 --- a/Zend/tests/traits/trait_type_errors.phpt +++ b/Zend/tests/traits/trait_type_errors.phpt @@ -22,22 +22,22 @@ class P extends C { $c = new C; try { $c->test1("foo"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $c->test2("foo"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $c->test3("foo"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -C::test1(): Return value must be of type int, string returned -C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d -C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d +TypeError: C::test1(): Return value must be of type int, string returned +TypeError: C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d +TypeError: C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d diff --git a/Zend/tests/trigger_error_basic.phpt b/Zend/tests/trigger_error_basic.phpt index d492590bcd92..f8d5209f9e0e 100644 --- a/Zend/tests/trigger_error_basic.phpt +++ b/Zend/tests/trigger_error_basic.phpt @@ -7,13 +7,13 @@ var_dump(trigger_error("error")); try { var_dump(trigger_error("error", -1)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(trigger_error("error", 0)); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(trigger_error("error", E_USER_WARNING)); @@ -23,8 +23,8 @@ var_dump(trigger_error("error", E_USER_DEPRECATED)); --EXPECTF-- Notice: error in %s on line %d bool(true) -trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED -trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED +ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED +ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED Warning: error in %s on line %d bool(true) diff --git a/Zend/tests/try/bug70228_3.phpt b/Zend/tests/try/bug70228_3.phpt index 80a0f379765b..d29d0cd89b1f 100644 --- a/Zend/tests/try/bug70228_3.phpt +++ b/Zend/tests/try/bug70228_3.phpt @@ -19,14 +19,14 @@ function test() { try { var_dump(test()); -} catch (Exception $e) { +} catch (Throwable $e) { do { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; $e = $e->getPrevious(); } while ($e); } ?> --EXPECTF-- Deprecated: Returning from a finally block is deprecated in %s on line %d -2 -1 +Exception: 2 +Exception: 1 diff --git a/Zend/tests/try/bug70228_4.phpt b/Zend/tests/try/bug70228_4.phpt index 7e0fd78707d7..245433209de2 100644 --- a/Zend/tests/try/bug70228_4.phpt +++ b/Zend/tests/try/bug70228_4.phpt @@ -21,13 +21,13 @@ function test() { try { var_dump(test()); -} catch (Exception $e) { +} catch (Throwable $e) { do { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; $e = $e->getPrevious(); } while ($e); } ?> --EXPECTF-- Deprecated: Returning from a finally block is deprecated in %s on line %d -1 +Exception: 1 diff --git a/Zend/tests/try/bug70228_5.phpt b/Zend/tests/try/bug70228_5.phpt index 29cbf4910de1..b5aa085d5278 100644 --- a/Zend/tests/try/bug70228_5.phpt +++ b/Zend/tests/try/bug70228_5.phpt @@ -12,9 +12,9 @@ function test() { try { test(); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ops +Exception: ops diff --git a/Zend/tests/try/bug72213.phpt b/Zend/tests/try/bug72213.phpt index 50555f53e419..ba53b3bb037d 100644 --- a/Zend/tests/try/bug72213.phpt +++ b/Zend/tests/try/bug72213.phpt @@ -15,11 +15,11 @@ function test() { try { test(); -} catch (Exception $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->getPrevious()->getMessage()); } ?> --EXPECT-- -string(1) "b" +Exception: b string(1) "a" diff --git a/Zend/tests/try/bug72213_2.phpt b/Zend/tests/try/bug72213_2.phpt index a9b5f1490b2d..df5b8aad484b 100644 --- a/Zend/tests/try/bug72213_2.phpt +++ b/Zend/tests/try/bug72213_2.phpt @@ -18,9 +18,9 @@ function test() { try { test(); -} catch (Exception $e) { - echo "caught {$e->getMessage()}\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -caught 1 +Exception: 1 diff --git a/Zend/tests/try/catch_finally_006.phpt b/Zend/tests/try/catch_finally_006.phpt index 463ce377f0a3..fca1371fb671 100644 --- a/Zend/tests/try/catch_finally_006.phpt +++ b/Zend/tests/try/catch_finally_006.phpt @@ -17,9 +17,9 @@ function foo ($a) { try { var_dump(foo("para")); -} catch (Exception $e) { +} catch (Throwable $e) { "caught exception" . PHP_EOL; - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- diff --git a/Zend/tests/try/try_finally_002.phpt b/Zend/tests/try/try_finally_002.phpt index 99a34f62fbd7..a857f1e48a29 100644 --- a/Zend/tests/try/try_finally_002.phpt +++ b/Zend/tests/try/try_finally_002.phpt @@ -12,12 +12,12 @@ function foo () { try { foo(); -} catch (Exception $e) { +} catch (Throwable $e) { do { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } while ($e = $e->getPrevious()); } ?> --EXPECT-- -string(7) "finally" -string(3) "try" +Exception: finally +Exception: try diff --git a/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt b/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt index 3f720ba2b47f..d1fee2ce2c42 100644 --- a/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt +++ b/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt @@ -11,10 +11,10 @@ set_error_handler(function($_, $msg) { try { test(0.5); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Implicit conversion from float 0.5 to int loses precision +Exception: Implicit conversion from float 0.5 to int loses precision diff --git a/Zend/tests/type_coercion/gh22112.phpt b/Zend/tests/type_coercion/gh22112.phpt index 84fdc393a828..68e097894b56 100644 --- a/Zend/tests/type_coercion/gh22112.phpt +++ b/Zend/tests/type_coercion/gh22112.phpt @@ -19,17 +19,17 @@ $nan = fdiv(0, 0); try { take_bool($nan); -} catch (Exception $e) { - echo "bool: ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo 'bool: ', $e::class, ': ', $e->getMessage(), "\n"; } try { take_string($nan); -} catch (Exception $e) { - echo "string: ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo 'string: ', $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bool: unexpected NAN value was coerced to bool -string: unexpected NAN value was coerced to string +bool: Exception: unexpected NAN value was coerced to bool +string: Exception: unexpected NAN value was coerced to string diff --git a/Zend/tests/type_coercion/settype/settype_resource.phpt b/Zend/tests/type_coercion/settype/settype_resource.phpt index fa9ca739fa90..355b2362b85c 100644 --- a/Zend/tests/type_coercion/settype/settype_resource.phpt +++ b/Zend/tests/type_coercion/settype/settype_resource.phpt @@ -32,8 +32,8 @@ $vars = array( foreach ($vars as $var) { try { settype($var, "resource"); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + } catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump($var); } @@ -41,22 +41,22 @@ foreach ($vars as $var) { echo "Done\n"; ?> --EXPECTF-- -Cannot convert to resource type +ValueError: Cannot convert to resource type string(6) "string" -Cannot convert to resource type +ValueError: Cannot convert to resource type string(7) "8754456" -Cannot convert to resource type +ValueError: Cannot convert to resource type string(0) "" -Cannot convert to resource type +ValueError: Cannot convert to resource type string(1) "%0" -Cannot convert to resource type +ValueError: Cannot convert to resource type int(9876545) -Cannot convert to resource type +ValueError: Cannot convert to resource type float(0.1) -Cannot convert to resource type +ValueError: Cannot convert to resource type array(0) { } -Cannot convert to resource type +ValueError: Cannot convert to resource type array(3) { [0]=> int(1) @@ -65,15 +65,15 @@ array(3) { [2]=> int(3) } -Cannot convert to resource type +ValueError: Cannot convert to resource type bool(false) -Cannot convert to resource type +ValueError: Cannot convert to resource type bool(true) -Cannot convert to resource type +ValueError: Cannot convert to resource type NULL -Cannot convert to resource type +ValueError: Cannot convert to resource type resource(%d) of type (stream) -Cannot convert to resource type +ValueError: Cannot convert to resource type object(test)#%d (0) { } Done diff --git a/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt b/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt index 17921e5ae530..73fea49fb208 100644 --- a/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt +++ b/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt @@ -18,4 +18,4 @@ var_dump($nan); --EXPECT-- float(NAN) unexpected NAN value was coerced to string -string(3) "NAN" \ No newline at end of file +string(3) "NAN" diff --git a/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt b/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt index 26911bddb7eb..64e1fc6ad056 100644 --- a/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt +++ b/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt @@ -7,12 +7,12 @@ try { assert(false && function () { (void) somefunc(); }); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && function () { +AssertionError: assert(false && function () { (void)somefunc(); }) diff --git a/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt b/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt index 6375c60ab71b..72c2eb0f6d00 100644 --- a/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt +++ b/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt @@ -40,13 +40,13 @@ var_dump($o); try { bar1(); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bar2(); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -59,5 +59,5 @@ object(B)#%d (0) { } object(B)#%d (0) { } -bar1(): Return value must be of type (X&Y)|(W&Z), C returned -bar2(): Return value must be of type (W&Z)|(X&Y), C returned +TypeError: bar1(): Return value must be of type (X&Y)|(W&Z), C returned +TypeError: bar2(): Return value must be of type (W&Z)|(X&Y), C returned diff --git a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt index e9089c130b49..e5eaed0fd63e 100644 --- a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt +++ b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt @@ -39,23 +39,23 @@ $test->prop2 = $n; $c = new C(); try { $test->foo1($c); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->foo2($c); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop1 = $c; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = $c; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -67,8 +67,8 @@ object(A)#2 (0) { } NULL NULL -Test::foo1(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d -Test::foo2(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d -Cannot assign C to property Test::$prop1 of type (X&Y)|null -Cannot assign C to property Test::$prop2 of type (X&Y)|null +TypeError: Test::foo1(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d +TypeError: Test::foo2(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d +TypeError: Cannot assign C to property Test::$prop1 of type (X&Y)|null +TypeError: Cannot assign C to property Test::$prop2 of type (X&Y)|null ===DONE=== diff --git a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt index 4c9a5f95e30d..40c53e044dbd 100644 --- a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt +++ b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt @@ -60,43 +60,43 @@ $test->prop4 = $b; $c = new C(); try { $test->foo1($c); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->foo2($c); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->bar1($c); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->bar2($c); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop1 = $c; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = $c; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop3 = $c; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop4 = $c; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -116,12 +116,12 @@ object(B)#3 (0) { } object(B)#3 (0) { } -Test::foo1(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d -Test::foo2(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d -Test::bar1(): Argument #1 ($v) must be of type B|(X&Y), C given, called in %s on line %d -Test::bar2(): Argument #1 ($v) must be of type (X&Y)|B, C given, called in %s on line %d -Cannot assign C to property Test::$prop1 of type (X&Y)|int -Cannot assign C to property Test::$prop2 of type (X&Y)|int -Cannot assign C to property Test::$prop3 of type (X&Y)|B -Cannot assign C to property Test::$prop4 of type B|(X&Y) +TypeError: Test::foo1(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d +TypeError: Test::foo2(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d +TypeError: Test::bar1(): Argument #1 ($v) must be of type B|(X&Y), C given, called in %s on line %d +TypeError: Test::bar2(): Argument #1 ($v) must be of type (X&Y)|B, C given, called in %s on line %d +TypeError: Cannot assign C to property Test::$prop1 of type (X&Y)|int +TypeError: Cannot assign C to property Test::$prop2 of type (X&Y)|int +TypeError: Cannot assign C to property Test::$prop3 of type (X&Y)|B +TypeError: Cannot assign C to property Test::$prop4 of type B|(X&Y) ===DONE=== diff --git a/Zend/tests/type_declarations/dnf_types/gh9516.phpt b/Zend/tests/type_declarations/dnf_types/gh9516.phpt index 3d91932ebd45..db400d2535c7 100644 --- a/Zend/tests/type_declarations/dnf_types/gh9516.phpt +++ b/Zend/tests/type_declarations/dnf_types/gh9516.phpt @@ -25,28 +25,28 @@ try { $t->method1(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method1(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method1(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method1(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } // Lets try in reverse? @@ -54,28 +54,28 @@ try { $t->method2(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method2(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method2(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method2(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } /* Single before intersection */ @@ -83,28 +83,28 @@ try { $t->method3(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method3(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method3(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method3(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } // Lets try in reverse? @@ -112,46 +112,46 @@ try { $t->method4(new A_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method4(new B_); echo 'Fail', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method4(new AB_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } try { $t->method4(new D_); echo 'Pass', \PHP_EOL; } catch (\Throwable $throwable) { - echo $throwable->getMessage(), \PHP_EOL; + echo $throwable::class, ': ', $throwable->getMessage(), "\n"; } ?> --EXPECTF-- -T::method1(): Argument #1 ($arg) must be of type (A&B)|D, A_ given, called in %s on line %d -T::method1(): Argument #1 ($arg) must be of type (A&B)|D, B_ given, called in %s on line %d +TypeError: T::method1(): Argument #1 ($arg) must be of type (A&B)|D, A_ given, called in %s on line %d +TypeError: T::method1(): Argument #1 ($arg) must be of type (A&B)|D, B_ given, called in %s on line %d Pass Pass -T::method2(): Argument #1 ($arg) must be of type (B&A)|D, A_ given, called in %s on line %d -T::method2(): Argument #1 ($arg) must be of type (B&A)|D, B_ given, called in %s on line %d +TypeError: T::method2(): Argument #1 ($arg) must be of type (B&A)|D, A_ given, called in %s on line %d +TypeError: T::method2(): Argument #1 ($arg) must be of type (B&A)|D, B_ given, called in %s on line %d Pass Pass -T::method3(): Argument #1 ($arg) must be of type D|(A&B), A_ given, called in %s on line %d -T::method3(): Argument #1 ($arg) must be of type D|(A&B), B_ given, called in %s on line %d +TypeError: T::method3(): Argument #1 ($arg) must be of type D|(A&B), A_ given, called in %s on line %d +TypeError: T::method3(): Argument #1 ($arg) must be of type D|(A&B), B_ given, called in %s on line %d Pass Pass -T::method4(): Argument #1 ($arg) must be of type D|(B&A), A_ given, called in %s on line %d -T::method4(): Argument #1 ($arg) must be of type D|(B&A), B_ given, called in %s on line %d +TypeError: T::method4(): Argument #1 ($arg) must be of type D|(B&A), A_ given, called in %s on line %d +TypeError: T::method4(): Argument #1 ($arg) must be of type D|(B&A), B_ given, called in %s on line %d Pass Pass diff --git a/Zend/tests/type_declarations/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt index 5b2ad90abfea..da9ce52ce163 100644 --- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt +++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt @@ -7,29 +7,29 @@ declare(strict_types=1); echo "*** Trying Ord With Integer" . PHP_EOL; try { var_dump(ord(1)); -} catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "*** Trying Array Map With Invalid Callback" . PHP_EOL; try { array_map([null, "bar"], []); -} catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "*** Trying Strlen With Float" . PHP_EOL; try { var_dump(strlen(1.5)); -} catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- *** Trying Ord With Integer -*** Caught ord(): Argument #1 ($character) must be of type string, int given +TypeError: ord(): Argument #1 ($character) must be of type string, int given *** Trying Array Map With Invalid Callback -*** Caught array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object +TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object *** Trying Strlen With Float -*** Caught strlen(): Argument #1 ($string) must be of type string, float given +TypeError: strlen(): Argument #1 ($string) must be of type string, float given diff --git a/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt b/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt index 568e6e25afad..7490bcd8434d 100644 --- a/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt +++ b/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt @@ -28,8 +28,8 @@ $tc = new TestChild(); $o = new A(); try { $o->prop = $tp; -} catch (TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $o->prop = $tc; @@ -46,7 +46,7 @@ var_dump($r); ?> --EXPECTF-- -Cannot assign TestParent to property A::$prop of type X&Y&Z +TypeError: Cannot assign TestParent to property A::$prop of type X&Y&Z object(TestChild)#%d (0) { } object(TestParent)#%d (0) { diff --git a/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt b/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt index 83af5e96ccfa..c268720d4c2a 100644 --- a/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt +++ b/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt @@ -9,11 +9,11 @@ function foo(X&Y $foo = null) { try { foo(5); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: foo(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d -foo(): Argument #1 ($foo) must be of type (X&Y)|null, int given, called in %s on line %d +TypeError: foo(): Argument #1 ($foo) must be of type (X&Y)|null, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt b/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt index e724e1b15f50..5123be36f130 100644 --- a/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt +++ b/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt @@ -24,8 +24,8 @@ function bar(X&Y $o): void { try { $o = foo(); var_dump($o); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $c = new Collection(); @@ -33,18 +33,18 @@ $a = new A(); try { $c->intersect = $a; -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { bar($a); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -foo(): Return value must be of type X&Y, A returned -Cannot assign A to property Collection::$intersect of type X&Y -bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d +TypeError: foo(): Return value must be of type X&Y, A returned +TypeError: Cannot assign A to property Collection::$intersect of type X&Y +TypeError: bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/parameter.phpt b/Zend/tests/type_declarations/intersection_types/parameter.phpt index d1c7de224365..2de2d5b91edc 100644 --- a/Zend/tests/type_declarations/intersection_types/parameter.phpt +++ b/Zend/tests/type_declarations/intersection_types/parameter.phpt @@ -17,12 +17,12 @@ foo(new Foo()); try { foo(new Bar()); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- object(Foo)#1 (0) { } -foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d +TypeError: foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/typed_reference.phpt b/Zend/tests/type_declarations/intersection_types/typed_reference.phpt index 2ceb34f256ff..b16dfad4025b 100644 --- a/Zend/tests/type_declarations/intersection_types/typed_reference.phpt +++ b/Zend/tests/type_declarations/intersection_types/typed_reference.phpt @@ -21,10 +21,10 @@ $test->z =& $r; try { $r = new B; -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign B to reference held by property Test::$z of type X&Z +TypeError: Cannot assign B to reference held by property Test::$z of type X&Z diff --git a/Zend/tests/type_declarations/iterable/iterable_001.phpt b/Zend/tests/type_declarations/iterable/iterable_001.phpt index 7c127c8e1dfd..c264908fbb54 100644 --- a/Zend/tests/type_declarations/iterable/iterable_001.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_001.phpt @@ -20,7 +20,7 @@ test(new ArrayIterator([1, 2, 3])); try { test(1); } catch (Throwable $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -47,4 +47,4 @@ object(ArrayIterator)#1 (1) { int(3) } } -test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d +TypeError: test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/iterable/iterable_003.phpt b/Zend/tests/type_declarations/iterable/iterable_003.phpt index a2c96995da37..978f177fc4b4 100644 --- a/Zend/tests/type_declarations/iterable/iterable_003.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_003.phpt @@ -20,7 +20,7 @@ var_dump(bar()); try { baz(); } catch (Throwable $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -31,4 +31,4 @@ object(Generator)#%d (1) { ["function"]=> string(17) "{closure:bar():7}" } -baz(): Return value must be of type Traversable|array, int returned +TypeError: baz(): Return value must be of type Traversable|array, int returned diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt index 61900f993c0e..86eb1aee258a 100644 --- a/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt +++ b/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt @@ -7,22 +7,22 @@ function test(false $v) { var_dump($v); } try { test(0); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(''); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test([]); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -test(): Argument #1 ($v) must be of type false, int given, called in %s on line %d -test(): Argument #1 ($v) must be of type false, string given, called in %s on line %d -test(): Argument #1 ($v) must be of type false, array given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type false, int given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type false, string given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type false, array given, called in %s on line %d diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt index 726245705ffc..34480f91f1e2 100644 --- a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt +++ b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt @@ -21,11 +21,11 @@ $c = new C(); var_dump($p->foo(0)); try { var_dump($c->foo(0)); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(false) -C::foo(): Return value must be of type array|false, int returned +TypeError: C::foo(): Return value must be of type array|false, int returned diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt index 85d6c90cd057..72e9ae889802 100644 --- a/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt +++ b/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt @@ -7,28 +7,28 @@ function test(true $v) { var_dump($v); } try { test(1); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test('1'); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test([1]); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { test(new stdClass()); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d -test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d -test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d -test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d +TypeError: test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt index 7eebe1e3571f..a0ed9bf12d82 100644 --- a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt +++ b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt @@ -21,11 +21,11 @@ $c = new C(); var_dump($p->foo(1)); try { var_dump($c->foo(1)); -} catch (\TypeError $e) { - echo $e->getMessage(), \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -C::foo(): Return value must be of type array|true, int returned +TypeError: C::foo(): Return value must be of type array|true, int returned diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt index 8a2c60002054..edd4d59f580e 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt @@ -27,10 +27,10 @@ $foo = new Foo(); try { $foo->property1; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Typed property Foo::$property1 must not be accessed before initialization +Error: Typed property Foo::$property1 must not be accessed before initialization diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt index e83023d54cf2..720e9cdc13af 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt @@ -26,10 +26,10 @@ $foo = new Foo(); try { $foo->property1; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Typed property Foo::$property1 must not be accessed before initialization +Error: Typed property Foo::$property1 must not be accessed before initialization diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt index 2bd775af0a47..7712f5e3a0e4 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt @@ -10,10 +10,10 @@ function foo(): mixed try { foo(); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -foo(): Return value must be of type mixed, none returned +TypeError: foo(): Return value must be of type mixed, none returned diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt index 52bd99beb6cd..2e5efe16baae 100644 --- a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt +++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt @@ -9,10 +9,10 @@ function foo(): mixed try { foo(); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -foo(): Return value must be of type mixed, none returned +TypeError: foo(): Return value must be of type mixed, none returned diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt index 352c48f8a9e0..e6559a941742 100644 --- a/Zend/tests/type_declarations/scalar_basic.phpt +++ b/Zend/tests/type_declarations/scalar_basic.phpt @@ -52,8 +52,8 @@ foreach ($functions as $type => $function) { var_dump($value); try { var_dump($function($value)); - } catch (\TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -76,19 +76,19 @@ E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line int(1) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying int(%d) int(%d) *** Trying float(NAN) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) int(1) @@ -97,22 +97,22 @@ int(1) int(0) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -129,13 +129,13 @@ float(1) float(1.5) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying int(%d) float(%s) @@ -150,22 +150,22 @@ float(1) float(0) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: @@ -204,22 +204,22 @@ string(1) "1" string(0) "" *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } string(6) "foobar" *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: @@ -258,21 +258,21 @@ bool(true) bool(false) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt index 5e3826de7dcb..10dbab93e7aa 100644 --- a/Zend/tests/type_declarations/scalar_constant_defaults.phpt +++ b/Zend/tests/type_declarations/scalar_constant_defaults.phpt @@ -64,15 +64,15 @@ var_dump(string_add_val()); echo "Testing int with default null constant" . PHP_EOL; try { var_dump(int_val_default_null()); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Testing int with null null constant" . PHP_EOL; try { var_dump(int_val_default_null(null)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Testing nullable int with default null constant" . PHP_EOL; @@ -96,9 +96,9 @@ float(10.7) Testing string add val string(14) "this is a test" Testing int with default null constant -int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d +TypeError: int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d Testing int with null null constant -int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d +TypeError: int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d Testing nullable int with default null constant NULL Testing nullable int with null null constant From b394bfc5af6c003d02d323efc5d3c4cd96ef3900 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:26:23 +0700 Subject: [PATCH 19/27] ext/dom: applied fixers to improve test robustness (#23130) --- .../tests/DOM4_ChildNode_wrong_document.phpt | 10 +-- .../DOM4_DOMNode_removeDanglingElement.phpt | 6 +- .../DOM4_ParentNode_append_invalidtypes.phpt | 6 +- ...OM4_ParentNode_append_with_attributes.phpt | 6 +- ...DOM4_ParentNode_append_wrong_document.phpt | 8 +-- .../tests/DOMAttr_construct_error_001.phpt | 6 +- .../DOMCDATASection_construct_error_001.phpt | 6 +- .../DOMCharacterData_data_error_002.phpt | 6 +- ...DOMCharacterData_deleteData_error_002.phpt | 6 +- .../DOMCharacterData_length_error_001.phpt | 6 +- .../tests/DOMComment_construct_error_001.phpt | 6 +- ...MDocumentFragment_appendXML_error_002.phpt | 6 +- ...MDocumentFragment_construct_error_001.phpt | 6 +- .../DOMDocumentType_entities_error_001.phpt | 6 +- ...DocumentType_internalSubset_error_001.phpt | 6 +- .../tests/DOMDocumentType_name_error_001.phpt | 6 +- .../DOMDocumentType_notations_error_001.phpt | 6 +- .../DOMDocumentType_publicId_error_001.phpt | 6 +- .../DOMDocumentType_systemId_error_001.phpt | 6 +- ext/dom/tests/DOMDocument_adoptNode.phpt | 16 ++--- ...Document_createEntityReference_error1.phpt | 6 +- ext/dom/tests/DOMDocument_encoding_basic.phpt | 6 +- .../tests/DOMDocument_loadHTML_error2.phpt | 6 +- .../DOMDocument_loadHTMLfile_error2.phpt | 12 ++-- ext/dom/tests/DOMDocument_loadXML_error6.phpt | 6 +- ext/dom/tests/DOMDocument_load_error6.phpt | 12 ++-- .../DOMDocument_saveHTMLFile_error2.phpt | 6 +- ...ocument_saveHTMLFile_invalid_filename.phpt | 6 +- .../tests/DOMDocument_saveHTML_error2.phpt | 6 +- ...MDocument_schemaValidateSource_error3.phpt | 6 +- .../DOMDocument_schemaValidate_error3.phpt | 6 +- .../DOMDocument_schemaValidate_error6.phpt | 6 +- ...ocument_strictErrorChecking_variation.phpt | 10 +-- .../tests/DOMDocument_validate_error2.phpt | 6 +- ext/dom/tests/DOMDocument_version_write.phpt | 6 +- .../DOMElement_append_hierarchy_test.phpt | 24 +++---- ext/dom/tests/DOMElement_className.phpt | 4 +- ext/dom/tests/DOMElement_id.phpt | 4 +- .../DOMElement_insertAdjacentElement.phpt | 18 ++--- .../tests/DOMElement_insertAdjacentText.phpt | 6 +- ext/dom/tests/DOMElement_prefix_empty.phpt | 6 +- .../DOMElement_prepend_hierarchy_test.phpt | 24 +++---- ext/dom/tests/DOMElement_replaceChildren.phpt | 12 ++-- ext/dom/tests/DOMElement_toggleAttribute.phpt | 6 +- ext/dom/tests/DOMEntityReference_error1.phpt | 6 +- .../DOMNamedNodeMap_edge_case_offset.phpt | 10 +-- ext/dom/tests/DOMNode_C14NFile_basic.phpt | 12 ++-- ext/dom/tests/DOMNode_C14N_basic.phpt | 12 ++-- ext/dom/tests/DOMNode_contains.phpt | 6 +- .../tests/DOMNode_insertBefore_error1.phpt | 6 +- .../tests/DOMNode_insertBefore_error2.phpt | 6 +- .../tests/DOMNode_insertBefore_error3.phpt | 6 +- .../tests/DOMNode_insertBefore_error4.phpt | 6 +- .../tests/DOMNode_insertBefore_error5.phpt | 6 +- .../tests/DOMNode_insertBefore_error6.phpt | 6 +- ext/dom/tests/DOMNode_removeChild_error1.phpt | 4 +- .../tests/DOMNode_replaceChild_error1.phpt | 4 +- .../tests/DOMNode_replaceChild_error2.phpt | 4 +- ext/dom/tests/DOMProcessingInstruction.phpt | 22 +++--- ext/dom/tests/DOMXPath_callables.phpt | 10 +-- ext/dom/tests/DOMXPath_callables_errors.phpt | 40 +++++------ ext/dom/tests/DOMXPath_clone.phpt | 6 +- ext/dom/tests/bug44648.phpt | 24 +++---- ext/dom/tests/bug47430.phpt | 8 +-- ext/dom/tests/bug66783.phpt | 6 +- ext/dom/tests/bug67949.phpt | 6 +- ext/dom/tests/bug77569.phpt | 6 +- ext/dom/tests/c14n_no_nodeset_returned.phpt | 6 +- ext/dom/tests/clone_list_map_collection.phpt | 36 +++++----- .../delayed_freeing/direct_construction.phpt | 40 +++++------ .../delayed_freeing/without_contructor.phpt | 12 ++-- ext/dom/tests/dom_import_simplexml.phpt | 6 +- ext/dom/tests/dom_xinclude_errors.phpt | 6 +- ext/dom/tests/domxpath.phpt | 12 ++-- ext/dom/tests/entity_reference_stale_02.phpt | 4 +- .../tests/gh11830/attribute_variation.phpt | 30 ++++---- ext/dom/tests/gh11830/document_variation.phpt | 14 ++-- .../tests/gh11830/hierarchy_variation.phpt | 14 ++-- ext/dom/tests/gh11830/type_variation.phpt | 30 ++++---- ext/dom/tests/gh12002.phpt | 12 ++-- ext/dom/tests/gh13960.phpt | 6 +- ext/dom/tests/gh15137.phpt | 1 - ext/dom/tests/gh15910.phpt | 6 +- ext/dom/tests/gh16039.phpt | 12 ++-- ext/dom/tests/gh16151.phpt | 12 ++-- ext/dom/tests/gh16190.phpt | 6 +- ext/dom/tests/gh16316.phpt | 12 ++-- ext/dom/tests/gh16465.phpt | 18 ++--- ext/dom/tests/gh16533.phpt | 6 +- ext/dom/tests/gh16535.phpt | 6 +- ext/dom/tests/gh16593.phpt | 6 +- ext/dom/tests/gh16594.phpt | 6 +- ext/dom/tests/gh16777_1.phpt | 6 +- ext/dom/tests/gh16777_2.phpt | 6 +- ext/dom/tests/gh17847.phpt | 18 ++--- .../tests/modern/common/template_rename.phpt | 6 +- .../closest_invalid_selector.phpt | 6 +- .../modern/css_selectors/combinators.phpt | 6 +- .../matches_invalid_selector.phpt | 6 +- .../css_selectors/pseudo_classes_blank.phpt | 6 +- .../Element_renaming_html_ns_02.phpt | 12 ++-- .../attribute_renaming_conflict.phpt | 40 +++++------ .../node_renaming_validation_errors.phpt | 12 ++-- ...ment_createFromFile_override_encoding.phpt | 6 +- ...nt_createFromString_override_encoding.phpt | 6 +- .../HTMLDocument_encoding_field_test.phpt | 18 ++--- .../Document_body_setter_errors.phpt | 16 ++--- ...Dom_Element_insertAdjacentHTML_errors.phpt | 24 +++---- .../HTMLCollection_dimension_errors.phpt | 18 ++--- .../HTMLDocument_registerNodeClass_02.phpt | 6 +- .../interactions/without_constructor.phpt | 8 +-- ...nt_fromFile_nul_terminator_cases_path.phpt | 12 ++-- .../parser/HTMLDocument_parse_options.phpt | 68 +++++++++---------- ..._deleteData_negative_in_bounds_length.phpt | 6 +- .../CharacterData_insertData_edge_cases.phpt | 12 ++-- ...racterData_insertData_negative_offset.phpt | 6 +- ...Data_insertData_negative_offset_mod32.phpt | 18 ++--- ...Data_replaceData_negative_count_mod32.phpt | 12 ++-- ...haracterData_substringData_edge_cases.phpt | 18 ++--- ...Data_substringData_negative_arguments.phpt | 6 +- ...ubstringData_negative_arguments_mod32.phpt | 18 ++--- .../spec/Document_createAttributeNS.phpt | 18 ++--- .../modern/spec/Document_createElementNS.phpt | 14 ++-- .../Document_createElement_edge_cases.phpt | 12 ++-- ...lementation_createDocumentType_errors.phpt | 18 ++--- ..._implementation_createDocument_errors.phpt | 12 ++-- .../Document_implementation_same_object.phpt | 6 +- .../Document_importNode_not_supported.phpt | 6 +- .../spec/Element_insertAdjacentText.phpt | 6 +- .../modern/spec/Element_prefix_readonly.phpt | 6 +- .../Element_removeAttribute_edge_cases.phpt | 6 +- .../modern/spec/Element_setAttributeNS.phpt | 6 +- .../spec/Element_setAttributeNode_inuse.phpt | 6 +- .../spec/HTMLDocument_createCDATASection.phpt | 18 ++--- ...LDocument_createProcessingInstruction.phpt | 18 ++--- .../modern/spec/NamedNodeMap_dimensions.phpt | 8 +-- .../spec/NamedNodeMap_dimensions_errors.phpt | 6 +- .../modern/spec/NodeList_dimensions.phpt | 12 ++-- .../spec/NodeList_dimensions_errors.phpt | 6 +- .../spec/Node_appendChild_attribute.phpt | 6 +- ...ppendChild_fragment_multiple_elements.phpt | 6 +- .../spec/Node_appendChild_invalid_parent.phpt | 24 +++---- ...de_cloneNode_copy_document_properties.phpt | 6 +- .../modern/spec/Node_insertBefore_01.phpt | 6 +- .../modern/spec/Node_insertBefore_02.phpt | 6 +- .../spec/Node_replaceChild_edge_cases.phpt | 66 +++++++++--------- ...rentNode_append_exception_consistency.phpt | 6 +- .../modern/spec/ParentNode_edge_case.phpt | 6 +- .../spec/ParentNode_hierarchy_text_nodes.phpt | 24 +++---- .../modern/spec/Text_splitText_edge_case.phpt | 12 ++-- .../modern/spec/XMLDocument_version.phpt | 10 +-- .../modern/spec/appendChild_dtd_legacy.phpt | 6 +- .../append_text_nodes_invalid_hierarchy.phpt | 12 ++-- .../tests/modern/spec/documentURI_URL.phpt | 6 +- .../modern/spec/pre_insertion_validation.phpt | 54 +++++++-------- .../modern/spec/textContent_edge_cases.phpt | 6 +- .../tests/modern/token_list/add_errors.phpt | 24 +++---- .../modern/token_list/contains_error.phpt | 6 +- .../tests/modern/token_list/dimensions.phpt | 6 +- .../modern/token_list/dimensions_error.phpt | 30 ++++---- .../modern/token_list/foreach_by_ref.phpt | 6 +- .../modern/token_list/remove_errors.phpt | 24 +++---- .../modern/token_list/replace_error.phpt | 18 ++--- ext/dom/tests/modern/token_list/supports.phpt | 6 +- .../tests/modern/token_list/toggle_error.phpt | 12 ++-- .../modern/token_list/value_edge_cases.phpt | 6 +- ...edNodeMap_dimension_index_overflow_64.phpt | 8 +-- .../xml/Element_innerHTML_writing_errors.phpt | 16 ++--- ...Element_innerOuterHTML_reading_errors.phpt | 68 +++++++++---------- .../Element_insertAdjacentHTML_errors.phpt | 6 +- .../xml/Element_outerHTML_writing_errors.phpt | 12 ++-- .../xml/Node_removeChild_from_comment.phpt | 6 +- ...ment_createFromFile_override_encoding.phpt | 6 +- ...nt_createFromString_override_encoding.phpt | 6 +- .../modern/xml/XMLDocument_fromFile_03.phpt | 6 +- .../modern/xml/XMLDocument_fromString_03.phpt | 6 +- .../tests/modern/xml/XMLDocument_xpath.phpt | 6 +- .../modern/xml/XMLDocument_xpath_errors.phpt | 6 +- .../modern/xml/canonicalize_unattached.phpt | 6 +- .../modern/xml/serialize_empty_xmlns.phpt | 6 +- .../tests/modern/xml/simplexml_interop.phpt | 6 +- ext/dom/tests/not_serializable.phpt | 36 +++++----- ext/dom/tests/not_unserializable.phpt | 12 ++-- .../tests/null_text_content_manipulation.phpt | 24 +++---- ext/dom/tests/php_function_edge_cases.phpt | 10 +-- ext/dom/tests/property_write_errors.phpt | 36 +++++----- .../registerNodeClass_abstract_class.phpt | 4 +- .../tests/registerPhpFunctionNS_errors.phpt | 36 +++++----- ext/dom/tests/register_node_class.phpt | 6 +- .../replaceChild_attribute_validation.phpt | 6 +- ext/dom/tests/unsetting_properties.phpt | 12 ++-- .../xpath_domnamespacenode_advanced.phpt | 14 ++-- 192 files changed, 1119 insertions(+), 1120 deletions(-) diff --git a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt index cf51c3581a34..5942a4cf75fa 100644 --- a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt +++ b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt @@ -18,8 +18,8 @@ function test($method) { try { $element->$method($dom2->documentElement->firstChild); echo "FAIL"; - } catch (DOMException $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -29,6 +29,6 @@ test("replaceWith"); ?> --EXPECT-- -Wrong Document Error -Wrong Document Error -Wrong Document Error +DOMException: Wrong Document Error +DOMException: Wrong Document Error +DOMException: Wrong Document Error diff --git a/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt index 3890ef08d5b7..b1db57e4f31a 100644 --- a/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt +++ b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt @@ -11,9 +11,9 @@ $element = $dom->createElement('test'); try { $element->remove(); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt index 9a823e370a6e..2583bbe3178e 100644 --- a/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt +++ b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt @@ -11,9 +11,9 @@ $dom->loadXML(''); try { $dom->documentElement->append(array()); -} catch(TypeError $e) { - echo "OK! {$e->getMessage()}"; +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -OK! DOMElement::append(): Argument #1 must be of type DOMNode|string, array given +TypeError: DOMElement::append(): Argument #1 must be of type DOMNode|string, array given diff --git a/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt index 701dc1d0944b..75c6bc44d904 100644 --- a/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt +++ b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt @@ -18,13 +18,13 @@ $element = $dom->documentElement; try { $element->append($replacement, $addition); -} catch (DOMException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt index 9df1603cab0c..ec30546b8b54 100644 --- a/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt +++ b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt @@ -18,8 +18,8 @@ function test($method) { try { $element->$method($dom2->documentElement->firstChild); echo "FAIL"; - } catch (DOMException $e) { - echo $e->getMessage() . "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,5 +27,5 @@ test("append"); test("prepend"); ?> --EXPECT-- -Wrong Document Error -Wrong Document Error +DOMException: Wrong Document Error +DOMException: Wrong Document Error diff --git a/ext/dom/tests/DOMAttr_construct_error_001.phpt b/ext/dom/tests/DOMAttr_construct_error_001.phpt index 0839587caf46..1f4f73806d01 100644 --- a/ext/dom/tests/DOMAttr_construct_error_001.phpt +++ b/ext/dom/tests/DOMAttr_construct_error_001.phpt @@ -9,9 +9,9 @@ dom getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMAttr::__construct() expects at least 1 argument, 0 given +ArgumentCountError: DOMAttr::__construct() expects at least 1 argument, 0 given diff --git a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt index 50aacf05b9bd..9a3ba6448894 100644 --- a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt +++ b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt @@ -9,9 +9,9 @@ dom getMessage(); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMCdataSection::__construct() expects exactly 1 argument, 0 given +ArgumentCountError: DOMCdataSection::__construct() expects exactly 1 argument, 0 given diff --git a/ext/dom/tests/DOMCharacterData_data_error_002.phpt b/ext/dom/tests/DOMCharacterData_data_error_002.phpt index 71ef411a5cf8..f6fce4cc9c90 100644 --- a/ext/dom/tests/DOMCharacterData_data_error_002.phpt +++ b/ext/dom/tests/DOMCharacterData_data_error_002.phpt @@ -10,9 +10,9 @@ dom $character_data = new DOMCharacterData(); try { print $character_data->data; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt index 071ac52abf2b..0da7f7b5e414 100644 --- a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt +++ b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt @@ -15,9 +15,9 @@ $cdata = $document->createCDATASection('test'); $root->appendChild($cdata); try { $cdata->deleteData(5, 1); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/DOMCharacterData_length_error_001.phpt b/ext/dom/tests/DOMCharacterData_length_error_001.phpt index 8f0c66a12e72..7c446c1fc660 100644 --- a/ext/dom/tests/DOMCharacterData_length_error_001.phpt +++ b/ext/dom/tests/DOMCharacterData_length_error_001.phpt @@ -10,9 +10,9 @@ dom $character_data = new DOMCharacterData(); try { print $character_data->length; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMComment_construct_error_001.phpt b/ext/dom/tests/DOMComment_construct_error_001.phpt index 573a493827eb..eddb88e2be71 100644 --- a/ext/dom/tests/DOMComment_construct_error_001.phpt +++ b/ext/dom/tests/DOMComment_construct_error_001.phpt @@ -9,9 +9,9 @@ dom getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMComment::__construct() expects at most 1 argument, 2 given +ArgumentCountError: DOMComment::__construct() expects at most 1 argument, 2 given diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt index 85ff6b7667d3..ec8663836078 100644 --- a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt +++ b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt @@ -10,9 +10,9 @@ dom $fragment = new DOMDocumentFragment(); try { $fragment->appendXML('crankbait'); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -No Modification Allowed Error +DOMException: No Modification Allowed Error diff --git a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt index b05e1efc5f07..d025a7951cbc 100644 --- a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt +++ b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt @@ -9,9 +9,9 @@ dom getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given +ArgumentCountError: DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given diff --git a/ext/dom/tests/DOMDocumentType_entities_error_001.phpt b/ext/dom/tests/DOMDocumentType_entities_error_001.phpt index 3385a2f4e092..5b1eada08653 100644 --- a/ext/dom/tests/DOMDocumentType_entities_error_001.phpt +++ b/ext/dom/tests/DOMDocumentType_entities_error_001.phpt @@ -10,9 +10,9 @@ dom $doctype = new DOMDocumentType(); try { $doctype->entities; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt b/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt index efd00bc3bb1e..0de4fb21e9ad 100644 --- a/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt +++ b/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt @@ -10,9 +10,9 @@ dom $doctype = new DOMDocumentType(); try { $doctype->internalSubset; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMDocumentType_name_error_001.phpt b/ext/dom/tests/DOMDocumentType_name_error_001.phpt index 7714613a0eff..ab64a425a5fc 100644 --- a/ext/dom/tests/DOMDocumentType_name_error_001.phpt +++ b/ext/dom/tests/DOMDocumentType_name_error_001.phpt @@ -10,9 +10,9 @@ dom $doctype = new DOMDocumentType(); try { $doctype->name; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMDocumentType_notations_error_001.phpt b/ext/dom/tests/DOMDocumentType_notations_error_001.phpt index 9fa1c7510a6e..080fb85522fa 100644 --- a/ext/dom/tests/DOMDocumentType_notations_error_001.phpt +++ b/ext/dom/tests/DOMDocumentType_notations_error_001.phpt @@ -10,9 +10,9 @@ dom $doctype = new DOMDocumentType(); try { $notations = $doctype->notations; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt b/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt index 1a7fcd3feb42..f798f4191da8 100644 --- a/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt +++ b/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt @@ -10,9 +10,9 @@ dom $doctype = new DOMDocumentType(); try { $publicId = $doctype->publicId; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt b/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt index 3d5f7827eaad..fa41a8098a5f 100644 --- a/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt +++ b/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt @@ -10,9 +10,9 @@ dom $doctype = new DOMDocumentType(); try { $systemId = $doctype->systemId; -} catch (DOMException $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMDocument_adoptNode.phpt b/ext/dom/tests/DOMDocument_adoptNode.phpt index 2382cabd5136..5ecaef0083ad 100644 --- a/ext/dom/tests/DOMDocument_adoptNode.phpt +++ b/ext/dom/tests/DOMDocument_adoptNode.phpt @@ -20,8 +20,8 @@ var_dump($i_tag_element->ownerDocument === $doc2); echo "-- Trying to append child from other document --\n"; try { $doc2->firstChild->appendChild($b_tag_element); // Should fail because it's another document -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "-- Adopting --\n"; @@ -47,8 +47,8 @@ echo "-- Adopt a document (strict error on) --\n"; try { $doc1->adoptNode($doc1); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "-- Adopt a document (strict error off) --\n"; @@ -56,8 +56,8 @@ echo "-- Adopt a document (strict error off) --\n"; $doc1->strictErrorChecking = false; try { $doc1->adoptNode($doc1); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $doc1->strictErrorChecking = true; @@ -117,7 +117,7 @@ var_dump($child->nodeName); bool(true) bool(false) -- Trying to append child from other document -- -Wrong Document Error +DOMException: Wrong Document Error -- Adopting -- string(3) "hix" string(35) " @@ -138,7 +138,7 @@ string(27) "

" -- Adopt a document (strict error on) -- -Not Supported Error +DOMException: Not Supported Error -- Adopt a document (strict error off) -- Warning: DOMDocument::adoptNode(): Not Supported Error in %s on line %d diff --git a/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt b/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt index 381dd3d5557f..736687080e5e 100644 --- a/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt +++ b/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt @@ -8,11 +8,11 @@ $objDoc = new DomDocument(); try { $objDoc->createEntityReference('!'); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR); - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -Invalid Character Error +DOMException: Invalid Character Error diff --git a/ext/dom/tests/DOMDocument_encoding_basic.phpt b/ext/dom/tests/DOMDocument_encoding_basic.phpt index 8d7f11e1cc2a..30237c395120 100644 --- a/ext/dom/tests/DOMDocument_encoding_basic.phpt +++ b/ext/dom/tests/DOMDocument_encoding_basic.phpt @@ -24,8 +24,8 @@ echo "Empty Encoding Read: '{$dom->encoding}'\n"; try { $ret = $dom->encoding = 'NYPHP DOMinatrix'; echo "Adding invalid encoding: $ret\n"; -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ret = $dom->encoding = 'ISO-8859-1'; @@ -44,7 +44,7 @@ echo "UTF-16 Encoding Read: {$dom->encoding}\n"; ?> --EXPECT-- Empty Encoding Read: '' -Invalid document encoding +ValueError: Invalid document encoding Adding ISO-8859-1 encoding: ISO-8859-1 ISO-8859-1 Encoding Read: ISO-8859-1 Adding UTF-8 encoding: UTF-8 diff --git a/ext/dom/tests/DOMDocument_loadHTML_error2.phpt b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt index 6886240e595b..6d194309b588 100644 --- a/ext/dom/tests/DOMDocument_loadHTML_error2.phpt +++ b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt @@ -9,9 +9,9 @@ dom $doc = new DOMDocument(); try { $doc->loadHTML(''); -} catch (ValueError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocument::loadHTML(): Argument #1 ($source) must not be empty +ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt index a5ef58a65656..b508c3deb5da 100644 --- a/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt +++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt @@ -11,17 +11,17 @@ dom $doc = new DOMDocument(); try { $result = $doc->loadHTMLFile(""); -} catch (ValueError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $doc = new DOMDocument(); try { $result = $doc->loadHTMLFile("text.html\0something"); -} catch (ValueError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not be empty -DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not contain any null bytes +ValueError: DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not be empty +ValueError: DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not contain any null bytes diff --git a/ext/dom/tests/DOMDocument_loadXML_error6.phpt b/ext/dom/tests/DOMDocument_loadXML_error6.phpt index 748a8eb5dc1d..04a01530a0c7 100644 --- a/ext/dom/tests/DOMDocument_loadXML_error6.phpt +++ b/ext/dom/tests/DOMDocument_loadXML_error6.phpt @@ -8,9 +8,9 @@ dom $dom = new DOMDocument(); try { $dom->loadXML(""); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocument::loadXML(): Argument #1 ($source) must not be empty +ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty diff --git a/ext/dom/tests/DOMDocument_load_error6.phpt b/ext/dom/tests/DOMDocument_load_error6.phpt index a4f9bc4a02a8..05da066d4e8a 100644 --- a/ext/dom/tests/DOMDocument_load_error6.phpt +++ b/ext/dom/tests/DOMDocument_load_error6.phpt @@ -8,20 +8,20 @@ dom $dom = new DOMDocument(); try { $dom->load(""); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $dom->load("/path/with/\0/byte"); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } // Path is too long var_dump($dom->load(str_repeat(" ", PHP_MAXPATHLEN + 1))); ?> --EXPECT-- -DOMDocument::load(): Argument #1 ($filename) must not be empty -DOMDocument::load(): Argument #1 ($filename) must not contain any null bytes +ValueError: DOMDocument::load(): Argument #1 ($filename) must not be empty +ValueError: DOMDocument::load(): Argument #1 ($filename) must not contain any null bytes bool(false) diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt index 248ed48345ad..5288864e6e18 100644 --- a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt +++ b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt @@ -9,9 +9,9 @@ dom getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Non-static method DOMDocument::saveHTMLFile() cannot be called statically +Error: Non-static method DOMDocument::saveHTMLFile() cannot be called statically diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt index 8dc89f253012..a4fec56433c8 100644 --- a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt +++ b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt @@ -19,9 +19,9 @@ $text = $doc->createTextNode('This is the title'); $text = $title->appendChild($text); try { $doc->saveHTMLFile($filename); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty +ValueError: DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty diff --git a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt index 5e6fd0987108..6f7093d61024 100644 --- a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt +++ b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt @@ -9,9 +9,9 @@ dom getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Non-static method DOMDocument::saveHTML() cannot be called statically +Error: Non-static method DOMDocument::saveHTML() cannot be called statically diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt index ec295a55e339..0aa33d74d7f2 100644 --- a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt @@ -14,10 +14,10 @@ $doc->load(__DIR__."/book.xml"); try { $doc->schemaValidateSource(''); -} catch (ValueError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocument::schemaValidateSource(): Argument #1 ($source) must not be empty +ValueError: DOMDocument::schemaValidateSource(): Argument #1 ($source) must not be empty diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt index 274463e62e13..686952b197c3 100644 --- a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt @@ -14,10 +14,10 @@ $doc->load(__DIR__."/book.xml"); try { $doc->schemaValidate(''); -} catch (ValueError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMDocument::schemaValidate(): Argument #1 ($filename) must not be empty +ValueError: DOMDocument::schemaValidate(): Argument #1 ($filename) must not be empty diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt index c5d99b20a3fe..3407640c66b6 100644 --- a/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt @@ -11,15 +11,15 @@ $doc->load(__DIR__."/book.xml"); try { $doc->schemaValidate("/path/with/\0/byte"); -} catch (ValueError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($doc->schemaValidate(str_repeat(" ", PHP_MAXPATHLEN + 1))); ?> --EXPECTF-- -DOMDocument::schemaValidate(): Argument #1 ($filename) must not contain any null bytes +ValueError: DOMDocument::schemaValidate(): Argument #1 ($filename) must not contain any null bytes Warning: DOMDocument::schemaValidate(): Invalid Schema file source in %s on line %d bool(false) diff --git a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt index b44d6395c309..3b2d3c8fc4f9 100644 --- a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt +++ b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt @@ -19,9 +19,9 @@ var_dump($doc->strictErrorChecking); echo "Should throw DOMException when strictErrorChecking is on\n"; try { $attr = $doc->createAttribute(0); -} catch (DOMException $e) { +} catch (Throwable $e) { echo "GOOD. DOMException thrown\n"; - echo $e->getMessage() ."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } catch (Exception $e) { echo "OOPS. Other exception thrown\n"; } @@ -36,9 +36,9 @@ var_dump($doc->strictErrorChecking); echo "Should raise PHP error because strictErrorChecking is off\n"; try { $attr = $doc->createAttribute(0); -} catch (DOMException $e) { +} catch (Throwable $e) { echo "OOPS. DOMException thrown\n"; - echo $e->getMessage() ."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } catch (Exception $e) { echo "OOPS. Other exception thrown\n"; } @@ -50,7 +50,7 @@ See if strictErrorChecking is on bool(true) Should throw DOMException when strictErrorChecking is on GOOD. DOMException thrown -Invalid Character Error +DOMException: Invalid Character Error Turn strictErrorChecking off See if strictErrorChecking is off bool(false) diff --git a/ext/dom/tests/DOMDocument_validate_error2.phpt b/ext/dom/tests/DOMDocument_validate_error2.phpt index ccf59ddaebea..bfd952d8149e 100644 --- a/ext/dom/tests/DOMDocument_validate_error2.phpt +++ b/ext/dom/tests/DOMDocument_validate_error2.phpt @@ -9,9 +9,9 @@ dom getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Non-static method DOMDocument::validate() cannot be called statically +Error: Non-static method DOMDocument::validate() cannot be called statically diff --git a/ext/dom/tests/DOMDocument_version_write.phpt b/ext/dom/tests/DOMDocument_version_write.phpt index 3f594cb7e4b8..ca6f88f8ac51 100644 --- a/ext/dom/tests/DOMDocument_version_write.phpt +++ b/ext/dom/tests/DOMDocument_version_write.phpt @@ -18,8 +18,8 @@ echo $dom->saveXML(); try { $dom->version = new MyThrowingStringable; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->version); echo $dom->saveXML(); @@ -28,6 +28,6 @@ echo $dom->saveXML(); string(3) "1.0" string(6) "foobar" -An exception was thrown +Exception: An exception was thrown string(6) "foobar" diff --git a/ext/dom/tests/DOMElement_append_hierarchy_test.phpt b/ext/dom/tests/DOMElement_append_hierarchy_test.phpt index 63583c05bf53..2c17d887e0af 100644 --- a/ext/dom/tests/DOMElement_append_hierarchy_test.phpt +++ b/ext/dom/tests/DOMElement_append_hierarchy_test.phpt @@ -41,8 +41,8 @@ $dom = clone $dom_original; $b_hello = $dom->firstChild->firstChild; try { $b_hello->append($b_hello); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -51,8 +51,8 @@ $dom = clone $dom_original; $b_hello = $dom->firstChild->firstChild; try { $b_hello->append($b_hello, "foo"); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -62,8 +62,8 @@ $b_hello = $dom->firstChild->firstChild; $b_world = $b_hello->nextSibling; try { $b_world->firstChild->append($b_world); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -73,8 +73,8 @@ $dom2 = new DOMDocument; $dom2->loadXML('

other

'); try { $dom->firstChild->firstChild->prepend($dom2->firstChild); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom2->saveHTML()); var_dump($dom->saveHTML()); @@ -94,19 +94,19 @@ string(42) "

helloworldfoo

string(39) "

worldhello

" -- Append hello with itself -- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(39) "

helloworld

" -- Append hello with itself and text -- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(27) "

world

" -- Append world's i tag with the parent -- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(39) "

helloworld

" -- Append from another document -- -Wrong Document Error +DOMException: Wrong Document Error string(13) "

other

" string(39) "

helloworld

diff --git a/ext/dom/tests/DOMElement_className.phpt b/ext/dom/tests/DOMElement_className.phpt index fb19f0e23021..184726e1f4ed 100644 --- a/ext/dom/tests/DOMElement_className.phpt +++ b/ext/dom/tests/DOMElement_className.phpt @@ -28,7 +28,7 @@ var_dump($dom->documentElement->className); try { $dom->documentElement->className = new MyStringable(); } catch (Throwable $e) { - echo "Error: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->documentElement->className); echo $dom->saveXML(); @@ -41,7 +41,7 @@ string(0) "" string(2) "é" string(0) "" string(5) "12345" -Error: foo +Exception: foo string(5) "12345" diff --git a/ext/dom/tests/DOMElement_id.phpt b/ext/dom/tests/DOMElement_id.phpt index b406e3b43231..b810ba0fdb78 100644 --- a/ext/dom/tests/DOMElement_id.phpt +++ b/ext/dom/tests/DOMElement_id.phpt @@ -29,7 +29,7 @@ var_dump($div->id); try { $div->id = new MyStringable(); } catch (Throwable $e) { - echo "Error: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($div->id); echo $dom->saveXML(); @@ -44,7 +44,7 @@ string(0) "" string(2) "é" string(0) "" string(5) "12345" -Error: foo +Exception: foo string(5) "12345"
diff --git a/ext/dom/tests/DOMElement_insertAdjacentElement.phpt b/ext/dom/tests/DOMElement_insertAdjacentElement.phpt index 1e1eb1efecec..a82458abafec 100644 --- a/ext/dom/tests/DOMElement_insertAdjacentElement.phpt +++ b/ext/dom/tests/DOMElement_insertAdjacentElement.phpt @@ -17,8 +17,8 @@ var_dump($dom->createElement('free')->insertAdjacentElement("afterend", $dom->cr try { var_dump($dom->createElement('free')->insertAdjacentElement("bogus", $dom->createElement('element'))); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Hierarchy test ---\n"; @@ -28,8 +28,8 @@ $child = $element->appendChild($dom->createElement('child')); foreach (['beforebegin', 'afterbegin', 'beforeend', 'afterend'] as $where) { try { var_dump($child->insertAdjacentElement($where, $element)->tagName); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -84,12 +84,12 @@ echo $dom2->saveXML(); --- Edge cases --- NULL NULL -Syntax Error +DOMException: Syntax Error --- Hierarchy test --- -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error --- Normal cases uppercase --- string(1) "A" diff --git a/ext/dom/tests/DOMElement_insertAdjacentText.phpt b/ext/dom/tests/DOMElement_insertAdjacentText.phpt index 937f35f47acb..659ae53587a9 100644 --- a/ext/dom/tests/DOMElement_insertAdjacentText.phpt +++ b/ext/dom/tests/DOMElement_insertAdjacentText.phpt @@ -12,8 +12,8 @@ echo "--- Edge cases ---\n"; try { $dom->createElement('free')->insertAdjacentText("bogus", "bogus"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } function testNormalCases($dom, $uppercase) { @@ -56,7 +56,7 @@ var_dump($AText->textContent); ?> --EXPECT-- --- Edge cases --- -Syntax Error +DOMException: Syntax Error --- Normal cases uppercase --- A

foo

diff --git a/ext/dom/tests/DOMElement_prefix_empty.phpt b/ext/dom/tests/DOMElement_prefix_empty.phpt index 8cd3515889e9..a5150218a97e 100644 --- a/ext/dom/tests/DOMElement_prefix_empty.phpt +++ b/ext/dom/tests/DOMElement_prefix_empty.phpt @@ -29,8 +29,8 @@ echo "--- Changing the prefix to that of a conflicting namespace (\"conflict\") try { $container->prefix = "conflict"; -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(); @@ -46,6 +46,6 @@ echo $dom->saveXML(); --- Changing the prefix to that of a conflicting namespace ("conflict") --- -Namespace Error +DOMException: Namespace Error diff --git a/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt b/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt index b1a9910e0ee1..1dc34ffc4737 100644 --- a/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt +++ b/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt @@ -48,8 +48,8 @@ $dom = clone $dom_original; $b_hello = $dom->firstChild->firstChild; try { $b_hello->prepend($b_hello); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -58,8 +58,8 @@ $dom = clone $dom_original; $b_hello = $dom->firstChild->firstChild; try { $b_hello->prepend($b_hello, "foo"); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -69,8 +69,8 @@ $b_hello = $dom->firstChild->firstChild; $b_world = $b_hello->nextSibling; try { $b_world->firstChild->prepend($b_world); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -80,8 +80,8 @@ $dom2 = new DOMDocument; $dom2->loadXML('

other

'); try { $dom->firstChild->firstChild->prepend($dom2->firstChild); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom2->saveHTML()); var_dump($dom->saveHTML()); @@ -104,19 +104,19 @@ string(39) "

helloworld

string(42) "

hellofooworld

" -- Prepend hello with itself -- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(39) "

helloworld

" -- Prepend hello with itself and text -- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(27) "

world

" -- Prepend world's i tag with the parent -- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(39) "

helloworld

" -- Append from another document -- -Wrong Document Error +DOMException: Wrong Document Error string(13) "

other

" string(39) "

helloworld

diff --git a/ext/dom/tests/DOMElement_replaceChildren.phpt b/ext/dom/tests/DOMElement_replaceChildren.phpt index a28d99934183..3244462dc44e 100644 --- a/ext/dom/tests/DOMElement_replaceChildren.phpt +++ b/ext/dom/tests/DOMElement_replaceChildren.phpt @@ -12,14 +12,14 @@ echo "--- Edge cases ---\n"; try { $dom->documentElement->replaceChildren($dom->documentElement); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->documentElement->firstElementChild->replaceChildren($dom->documentElement); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Normal cases ---\n"; @@ -60,8 +60,8 @@ echo $dom->saveXML(); ?> --EXPECT-- --- Edge cases --- -Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error --- Normal cases --- diff --git a/ext/dom/tests/DOMElement_toggleAttribute.phpt b/ext/dom/tests/DOMElement_toggleAttribute.phpt index b9e9989e1fe0..3fe061b2cdd1 100644 --- a/ext/dom/tests/DOMElement_toggleAttribute.phpt +++ b/ext/dom/tests/DOMElement_toggleAttribute.phpt @@ -12,8 +12,8 @@ $xml->loadXML(''); try { var_dump($html->documentElement->toggleAttribute("\0")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Selected attribute tests (HTML) ---\n"; @@ -88,7 +88,7 @@ var_dump($dom->documentElement->getAttribute('xmlns:anotheron')); ?> --EXPECTF-- -Invalid Character Error +DOMException: Invalid Character Error --- Selected attribute tests (HTML) --- bool(false) diff --git a/ext/dom/tests/DOMEntityReference_error1.phpt b/ext/dom/tests/DOMEntityReference_error1.phpt index 1f805c1dbc80..eaf118a0b1d9 100644 --- a/ext/dom/tests/DOMEntityReference_error1.phpt +++ b/ext/dom/tests/DOMEntityReference_error1.phpt @@ -6,11 +6,11 @@ dom getCode() === DOM_INVALID_CHARACTER_ERR); - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -Invalid Character Error +DOMException: Invalid Character Error diff --git a/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt b/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt index 30a961143c77..4538112b4d6a 100644 --- a/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt +++ b/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt @@ -13,17 +13,17 @@ var_dump($root->attributes->length); // Consistent with the method call try { var_dump($root->attributes[-1]); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[][] = null; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- int(1) -must be between 0 and 2147483647 -Cannot access DOMNamedNodeMap without offset +ValueError: must be between 0 and 2147483647 +Error: Cannot access DOMNamedNodeMap without offset diff --git a/ext/dom/tests/DOMNode_C14NFile_basic.phpt b/ext/dom/tests/DOMNode_C14NFile_basic.phpt index fea039d3ca94..11d9874e42bb 100644 --- a/ext/dom/tests/DOMNode_C14NFile_basic.phpt +++ b/ext/dom/tests/DOMNode_C14NFile_basic.phpt @@ -27,13 +27,13 @@ $content = file_get_contents($output); var_dump($content); try { var_dump($node->C14NFile($output, false, false, [])); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($node->C14NFile($output, false, false, ['query' => []])); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --CLEAN-- @@ -44,5 +44,5 @@ unlink($output); --EXPECT-- int(34) string(34) "The Grapes of Wrath" -DOMNode::C14NFile(): Argument #4 ($xpath) must have a "query" key -DOMNode::C14NFile(): Argument #4 ($xpath) "query" option must be a string, array given +ValueError: DOMNode::C14NFile(): Argument #4 ($xpath) must have a "query" key +TypeError: DOMNode::C14NFile(): Argument #4 ($xpath) "query" option must be a string, array given diff --git a/ext/dom/tests/DOMNode_C14N_basic.phpt b/ext/dom/tests/DOMNode_C14N_basic.phpt index f936f9faa9a6..f624070efcd4 100644 --- a/ext/dom/tests/DOMNode_C14N_basic.phpt +++ b/ext/dom/tests/DOMNode_C14N_basic.phpt @@ -25,16 +25,16 @@ var_dump($node->C14N()); try { var_dump($node->C14N(false, false, [])); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($node->C14N(false, false, ['query' => []])); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(34) "The Grapes of Wrath" -DOMNode::C14N(): Argument #3 ($xpath) must have a "query" key -DOMNode::C14N(): Argument #3 ($xpath) "query" option must be a string, array given +ValueError: DOMNode::C14N(): Argument #3 ($xpath) must have a "query" key +TypeError: DOMNode::C14N(): Argument #3 ($xpath) "query" option must be a string, array given diff --git a/ext/dom/tests/DOMNode_contains.phpt b/ext/dom/tests/DOMNode_contains.phpt index 5c18963804cf..35a5240b1249 100644 --- a/ext/dom/tests/DOMNode_contains.phpt +++ b/ext/dom/tests/DOMNode_contains.phpt @@ -34,8 +34,8 @@ var_dump($dom->documentElement->contains(null)); try { var_dump($dom->contains(new stdClass)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- True cases ---\n"; @@ -78,7 +78,7 @@ var_dump($dom->contains($main)); --EXPECT-- --- False edge cases --- bool(false) -DOMNode::contains(): Argument #1 ($other) must be of type DOMNode|DOMNameSpaceNode|null, stdClass given +TypeError: DOMNode::contains(): Argument #1 ($other) must be of type DOMNode|DOMNameSpaceNode|null, stdClass given --- True cases --- bool(true) bool(true) diff --git a/ext/dom/tests/DOMNode_insertBefore_error1.phpt b/ext/dom/tests/DOMNode_insertBefore_error1.phpt index 9b42ef46c9ef..1cc2d7568362 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error1.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error1.phpt @@ -15,10 +15,10 @@ $node_in_doc2 = $doc2->createElement("bar"); try { $node_in_doc2->insertBefore($node_in_doc1); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Wrong Document Error +DOMException: Wrong Document Error diff --git a/ext/dom/tests/DOMNode_insertBefore_error2.phpt b/ext/dom/tests/DOMNode_insertBefore_error2.phpt index 317eb897919e..761baf2c04c0 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error2.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error2.phpt @@ -27,10 +27,10 @@ $ref_node = $dom->getElementsByTagName("book")->item(1); try { $parent_node->insertBefore($new_node, $ref_node); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/DOMNode_insertBefore_error3.phpt b/ext/dom/tests/DOMNode_insertBefore_error3.phpt index 9fa25e3b2acd..6daf1046edaf 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error3.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error3.phpt @@ -28,10 +28,10 @@ assert(!is_null($ref_node)); try { $parent_node->insertBefore($new_node, $ref_node); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/DOMNode_insertBefore_error4.phpt b/ext/dom/tests/DOMNode_insertBefore_error4.phpt index 41838bb78a1e..003c126a087c 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error4.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error4.phpt @@ -27,10 +27,10 @@ $ref_node = $dom->createElement('newnode2'); try { $parent_node->insertBefore($new_node, $ref_node); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/DOMNode_insertBefore_error5.phpt b/ext/dom/tests/DOMNode_insertBefore_error5.phpt index 17ac53820662..ae127b17e584 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error5.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error5.phpt @@ -29,10 +29,10 @@ $dom->saveXML(); try { $parent_node->insertBefore($new_node, $ref_node); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/DOMNode_insertBefore_error6.phpt b/ext/dom/tests/DOMNode_insertBefore_error6.phpt index a8348791f175..ff0ae450f893 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error6.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error6.phpt @@ -24,10 +24,10 @@ assert($new_node !== false); try { $parent_node->insertBefore($new_node, $ref_node); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/DOMNode_removeChild_error1.phpt b/ext/dom/tests/DOMNode_removeChild_error1.phpt index 05d3c31624f9..5f8cf1ab5198 100644 --- a/ext/dom/tests/DOMNode_removeChild_error1.phpt +++ b/ext/dom/tests/DOMNode_removeChild_error1.phpt @@ -13,8 +13,8 @@ $real_parent->appendChild($child1); $parent->appendChild($child2); try { $parent->removeChild($child1); -} catch (DOMException $e) { - echo "DOMException: " . $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_replaceChild_error1.phpt b/ext/dom/tests/DOMNode_replaceChild_error1.phpt index f276fc8d207e..2e050707c70e 100644 --- a/ext/dom/tests/DOMNode_replaceChild_error1.phpt +++ b/ext/dom/tests/DOMNode_replaceChild_error1.phpt @@ -14,8 +14,8 @@ $real_parent->appendChild($child1); $parent->appendChild($child2); try { $parent->replaceChild($child3, $child1); -} catch (DOMException $e) { - echo "DOMException: " . $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_replaceChild_error2.phpt b/ext/dom/tests/DOMNode_replaceChild_error2.phpt index 160838a537d1..bf608b181513 100644 --- a/ext/dom/tests/DOMNode_replaceChild_error2.phpt +++ b/ext/dom/tests/DOMNode_replaceChild_error2.phpt @@ -12,8 +12,8 @@ $a->appendChild($b); $b->appendChild($c); try { $b->replaceChild($a, $c); -} catch (DOMException $e) { - echo "DOMException: " . $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMProcessingInstruction.phpt b/ext/dom/tests/DOMProcessingInstruction.phpt index ca79e31966ef..2602c0f92b3b 100644 --- a/ext/dom/tests/DOMProcessingInstruction.phpt +++ b/ext/dom/tests/DOMProcessingInstruction.phpt @@ -15,8 +15,8 @@ echo "--- Test construction ---\n"; try { $pi = new DOMProcessingInstruction("\0"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $pi = new DOMProcessingInstruction("test"); @@ -30,7 +30,7 @@ var_dump($pi->data); try { $pi->data = new FailingStringable; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($pi->data); $pi->data = 12345; @@ -53,28 +53,28 @@ $instance = $class->newInstanceWithoutConstructor(); try { var_dump($instance->target); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($instance->data); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $instance->data = "hello"; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- --- Test construction --- -Invalid Character Error +DOMException: Invalid Character Error --- Test fields --- string(4) "test" string(0) "" string(2) "ok" -failed in __toString +Exception: failed in __toString string(2) "ok" string(5) "12345" string(10) "my data <>" @@ -82,6 +82,6 @@ string(10) "my data <>" ?> --- Test construction with __construct by reflection and fields --- -Invalid State Error -Invalid State Error -Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/DOMXPath_callables.phpt b/ext/dom/tests/DOMXPath_callables.phpt index 3d20527475da..402d7b285a16 100644 --- a/ext/dom/tests/DOMXPath_callables.phpt +++ b/ext/dom/tests/DOMXPath_callables.phpt @@ -30,8 +30,8 @@ $xpath = new DOMXPath($doc); $xpath->registerNamespace("php", "http://php.net/xpath"); try { $xpath->evaluate("//a[php:function('var_dump', string(@href))]"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Legit cases: all ---\n"; @@ -55,7 +55,7 @@ $xpath->evaluate("//a[php:function('var_dump', string(@href))]"); try { $xpath->evaluate("//a[php:function('notinset', string(@href))]"); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Legit cases: set with cycle ---\n"; @@ -73,7 +73,7 @@ $xpath->evaluate("//a[php:function('var_dump', string(@href))]"); ?> --EXPECT-- --- Legit cases: none --- -No callbacks were registered +Error: No callbacks were registered --- Legit cases: all --- string(15) "https://php.net" string(15) "https://php.net" @@ -81,7 +81,7 @@ string(15) "https://php.net" string(15) "https://php.net" string(15) "https://php.net" string(15) "https://php.net" -No callback handler "notinset" registered +Error: No callback handler "notinset" registered --- Legit cases: set with cycle --- dummy: https://php.net --- Legit cases: reset to null --- diff --git a/ext/dom/tests/DOMXPath_callables_errors.phpt b/ext/dom/tests/DOMXPath_callables_errors.phpt index 10019474e7e7..a34427ebefd8 100644 --- a/ext/dom/tests/DOMXPath_callables_errors.phpt +++ b/ext/dom/tests/DOMXPath_callables_errors.phpt @@ -11,50 +11,50 @@ $doc->loadHTML('hello'); $xpath = new DOMXPath($doc); try { $xpath->registerPhpFunctions("nonexistent"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(function () {}); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions([function () {}]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions([var_dump(...)]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(["nonexistent"]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(["" => var_dump(...)]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(["\0" => var_dump(...)]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(""); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = new class { @@ -67,17 +67,17 @@ try { $str = str_repeat($classes[count($classes) - 1] . '::dump', random_int(1, 1)); $xpath->registerPhpFunctions([$str]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "nonexistent" not found or invalid function name -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be of type array|string|null, Closure given -Object of class Closure could not be converted to string -Object of class Closure could not be converted to string -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "nonexistent" not found or invalid function name -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a valid callback name -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names +TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "nonexistent" not found or invalid function name +TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be of type array|string|null, Closure given +Error: Object of class Closure could not be converted to string +Error: Object of class Closure could not be converted to string +TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "nonexistent" not found or invalid function name +ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names +ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names +ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a valid callback name +ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names diff --git a/ext/dom/tests/DOMXPath_clone.phpt b/ext/dom/tests/DOMXPath_clone.phpt index 99cf1d4e08ca..3d29b23cb81c 100644 --- a/ext/dom/tests/DOMXPath_clone.phpt +++ b/ext/dom/tests/DOMXPath_clone.phpt @@ -13,10 +13,10 @@ $dom = new DOMDocument; $xpath = new DOMXPath($dom); try { clone $xpath; -} 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 DOMXPath +Error: Trying to clone an uncloneable object of class DOMXPath diff --git a/ext/dom/tests/bug44648.phpt b/ext/dom/tests/bug44648.phpt index 9dca0c9d70fb..d9ac8b0ae5f1 100644 --- a/ext/dom/tests/bug44648.phpt +++ b/ext/dom/tests/bug44648.phpt @@ -13,33 +13,33 @@ $root = $doc->documentElement; try { $attr = new DOMAttr('@acb', '123'); $root->setAttributeNode($attr); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->setAttribute('@def', '456'); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->setAttributeNS(NULL, '@ghi', '789'); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->setAttributeNS('urn::test', 'a:g@hi', '789'); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $doc->saveXML($root); ?> --EXPECT-- -Invalid Character Error -Invalid Character Error -Invalid Character Error -Namespace Error +DOMException: Invalid Character Error +DOMException: Invalid Character Error +DOMException: Invalid Character Error +DOMException: Namespace Error diff --git a/ext/dom/tests/bug47430.phpt b/ext/dom/tests/bug47430.phpt index f2428f73d3d5..30c4b8703fbe 100644 --- a/ext/dom/tests/bug47430.phpt +++ b/ext/dom/tests/bug47430.phpt @@ -13,8 +13,8 @@ $elements = $dom->getElementsByTagName('i'); foreach ($elements as $i) { try { $i->previousSibling->nodeValue = ''; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -25,8 +25,8 @@ print_r($arr); ?> --EXPECT-- -Attempt to assign property "nodeValue" on null -Attempt to assign property "nodeValue" on null +Error: Attempt to assign property "nodeValue" on null +Error: Attempt to assign property "nodeValue" on null Array ( [0] => Value diff --git a/ext/dom/tests/bug66783.phpt b/ext/dom/tests/bug66783.phpt index a9feba9529a3..06649464ed7f 100644 --- a/ext/dom/tests/bug66783.phpt +++ b/ext/dom/tests/bug66783.phpt @@ -9,9 +9,9 @@ $doc->loadXML(''); $e = $doc->createElement('e'); try { $e->appendChild($doc); -} catch (DOMException $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt index f087633bdfe6..8f1bd99ea094 100644 --- a/ext/dom/tests/bug67949.phpt +++ b/ext/dom/tests/bug67949.phpt @@ -45,8 +45,8 @@ var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent); echo "--- testing read_dimension with null offset ---\n"; try { var_dump($nodes[][] = 1); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- testing attribute access ---\n"; @@ -87,7 +87,7 @@ Warning: Attempt to read property "textContent" on null in %s on line %d bool(false) NULL --- testing read_dimension with null offset --- -Cannot access DOMNodeList without offset +Error: Cannot access DOMNodeList without offset --- testing attribute access --- string(4) "href" ==DONE== diff --git a/ext/dom/tests/bug77569.phpt b/ext/dom/tests/bug77569.phpt index 68e6e87a04d4..0ebf39f59464 100644 --- a/ext/dom/tests/bug77569.phpt +++ b/ext/dom/tests/bug77569.phpt @@ -8,9 +8,9 @@ $imp = new DOMImplementation; $dom = $imp->createDocument("", ""); try { $dom->encoding = null; -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid document encoding +ValueError: Invalid document encoding diff --git a/ext/dom/tests/c14n_no_nodeset_returned.phpt b/ext/dom/tests/c14n_no_nodeset_returned.phpt index 66efd8ba2b46..2fe203f3ecd4 100644 --- a/ext/dom/tests/c14n_no_nodeset_returned.phpt +++ b/ext/dom/tests/c14n_no_nodeset_returned.phpt @@ -8,9 +8,9 @@ $dom = new DOMDocument; $dom->loadXML('test'); try { $dom->documentElement->C14N(true, false, ['query' => 'string(./root/text())']); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -XPath query did not return a nodeset +Error: XPath query did not return a nodeset diff --git a/ext/dom/tests/clone_list_map_collection.phpt b/ext/dom/tests/clone_list_map_collection.phpt index 1eb91c46069b..a093abe56fe8 100644 --- a/ext/dom/tests/clone_list_map_collection.phpt +++ b/ext/dom/tests/clone_list_map_collection.phpt @@ -9,42 +9,42 @@ $dom = new DOMDocument; $dom->loadXML(''); try { clone $dom->documentElement->attributes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->documentElement->childNodes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createFromString(']>'); try { clone $dom->documentElement->attributes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->documentElement->childNodes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->documentElement->children; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->doctype->entities; -} 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 DOMNamedNodeMap -Trying to clone an uncloneable object of class DOMNodeList -Trying to clone an uncloneable object of class Dom\NamedNodeMap -Trying to clone an uncloneable object of class Dom\NodeList -Trying to clone an uncloneable object of class Dom\HTMLCollection -Trying to clone an uncloneable object of class Dom\DtdNamedNodeMap +Error: Trying to clone an uncloneable object of class DOMNamedNodeMap +Error: Trying to clone an uncloneable object of class DOMNodeList +Error: Trying to clone an uncloneable object of class Dom\NamedNodeMap +Error: Trying to clone an uncloneable object of class Dom\NodeList +Error: Trying to clone an uncloneable object of class Dom\HTMLCollection +Error: Trying to clone an uncloneable object of class Dom\DtdNamedNodeMap diff --git a/ext/dom/tests/delayed_freeing/direct_construction.phpt b/ext/dom/tests/delayed_freeing/direct_construction.phpt index 5162d6740177..6ec7bd72d7ec 100644 --- a/ext/dom/tests/delayed_freeing/direct_construction.phpt +++ b/ext/dom/tests/delayed_freeing/direct_construction.phpt @@ -9,12 +9,12 @@ function node_alike_test($test) { var_dump($test->parentNode); var_dump($test->nodeValue); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->appendChild($test)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -23,12 +23,12 @@ $test = new DOMCharacterData("test"); try { var_dump($test->textContent); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->appendData('test')); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "-- Test DOMCdataSection --\n"; @@ -42,12 +42,12 @@ try { var_dump($test->wholeText); var_dump($test->parentNode); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->isWhitespaceInElementContent()); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "-- Test DOMComment --\n"; @@ -63,7 +63,7 @@ var_dump($test->parentNode); try { var_dump($test->appendChild($test)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "-- Test DOMNode --\n"; @@ -81,12 +81,12 @@ try { var_dump($test->nodeValue); var_dump($test->parentNode); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test->appendChild($test)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "-- Test DOMAttr --\n"; @@ -96,13 +96,13 @@ var_dump($test->parentNode); try { var_dump($test->appendChild($test)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -- Test DOMCharacterData -- -Invalid State Error -Couldn't fetch DOMCharacterData +DOMException: Invalid State Error +Error: Couldn't fetch DOMCharacterData -- Test DOMCdataSection -- string(4) "test" bool(true) @@ -117,21 +117,21 @@ int(0) -- Test DOMElement -- string(4) "test" NULL -No Modification Allowed Error +DOMException: No Modification Allowed Error -- Test DOMNode -- -Invalid State Error -Couldn't fetch DOMNode +DOMException: Invalid State Error +Error: Couldn't fetch DOMNode -- Test DOMNotation -- -Invalid State Error -Couldn't fetch DOMNotation +DOMException: Invalid State Error +Error: Couldn't fetch DOMNotation -- Test DOMProcessingInstruction -- NULL string(5) "value" bool(false) -- Test DOMEntity -- -Invalid State Error -Couldn't fetch DOMEntity +DOMException: Invalid State Error +Error: Couldn't fetch DOMEntity -- Test DOMAttr -- string(5) "value" NULL -No Modification Allowed Error +DOMException: No Modification Allowed Error diff --git a/ext/dom/tests/delayed_freeing/without_contructor.phpt b/ext/dom/tests/delayed_freeing/without_contructor.phpt index 4a5f63ed9acc..22b1c6cd556c 100644 --- a/ext/dom/tests/delayed_freeing/without_contructor.phpt +++ b/ext/dom/tests/delayed_freeing/without_contructor.phpt @@ -11,14 +11,14 @@ $node = $rc->newInstanceWithoutConstructor(); try { var_dump($node); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Call test try { $node->removeChild($node); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Import test @@ -26,13 +26,13 @@ $doc = new DOMDocument; try { $doc->appendChild($doc->importNode($node)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- object(DOMNode)#2 (0) { } -Invalid State Error -Couldn't fetch DOMNode -Couldn't fetch DOMNode +DOMException: Invalid State Error +Error: Couldn't fetch DOMNode +Error: Couldn't fetch DOMNode diff --git a/ext/dom/tests/dom_import_simplexml.phpt b/ext/dom/tests/dom_import_simplexml.phpt index e761bfa66d85..179ed7e65b58 100644 --- a/ext/dom/tests/dom_import_simplexml.phpt +++ b/ext/dom/tests/dom_import_simplexml.phpt @@ -16,8 +16,8 @@ print $dom->ownerDocument->saveXML(); // This should fail because it has been imported already above in legacy DOM try { Dom\import_simplexml($s); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -32,4 +32,4 @@ try { John Steinbeck -Dom\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode +TypeError: Dom\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode diff --git a/ext/dom/tests/dom_xinclude_errors.phpt b/ext/dom/tests/dom_xinclude_errors.phpt index fe3addf85916..3c7b96993a30 100644 --- a/ext/dom/tests/dom_xinclude_errors.phpt +++ b/ext/dom/tests/dom_xinclude_errors.phpt @@ -14,10 +14,10 @@ $dom->xinclude(PHP_INT_MAX); $dom = Dom\XMLDocument::createEmpty(); try { $dom->xinclude(PHP_INT_MAX); -} catch (ValueError $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: DOMDocument::xinclude(): Invalid flags in %s on line %d -Dom\XMLDocument::xinclude(): Argument #1 ($options) is too large +ValueError: Dom\XMLDocument::xinclude(): Argument #1 ($options) is too large diff --git a/ext/dom/tests/domxpath.phpt b/ext/dom/tests/domxpath.phpt index cead1f8d5b7c..19ee76332134 100644 --- a/ext/dom/tests/domxpath.phpt +++ b/ext/dom/tests/domxpath.phpt @@ -54,14 +54,14 @@ var_dump($avg); try { $xpath->registerPHPFunctions('non_existent'); $avg = $xpath->evaluate('number(php:function("non_existent", //def:testnode))'); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(['non_existant']); $avg = $xpath->evaluate('number(php:function("non_existent", //def:testnode))'); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -69,5 +69,5 @@ myval float(1) bool(true) float(4) -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "non_existent" not found or invalid function name -DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "non_existant" not found or invalid function name +TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "non_existent" not found or invalid function name +TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "non_existant" not found or invalid function name diff --git a/ext/dom/tests/entity_reference_stale_02.phpt b/ext/dom/tests/entity_reference_stale_02.phpt index 9e25a2c0e94a..95abfb07ef56 100644 --- a/ext/dom/tests/entity_reference_stale_02.phpt +++ b/ext/dom/tests/entity_reference_stale_02.phpt @@ -26,8 +26,8 @@ unset($decl); try { var_dump($iter->current()->publicId); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/ext/dom/tests/gh11830/attribute_variation.phpt b/ext/dom/tests/gh11830/attribute_variation.phpt index 34a6f094f58f..7c5281e1044b 100644 --- a/ext/dom/tests/gh11830/attribute_variation.phpt +++ b/ext/dom/tests/gh11830/attribute_variation.phpt @@ -14,42 +14,42 @@ XML); try { $doc->documentElement->firstElementChild->prepend($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->append($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->before($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->after($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->replaceWith($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $doc->saveXML(); ?> --EXPECT-- -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/gh11830/document_variation.phpt b/ext/dom/tests/gh11830/document_variation.phpt index 1f291b946878..be7056d999c4 100644 --- a/ext/dom/tests/gh11830/document_variation.phpt +++ b/ext/dom/tests/gh11830/document_variation.phpt @@ -26,8 +26,8 @@ function test($method) { try { $doc->documentElement->firstElementChild->$method($testElement, $otherElement); - } catch (\DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $otherDoc->saveXML(); @@ -41,7 +41,7 @@ test("after"); test("replaceWith"); ?> --EXPECT-- -Wrong Document Error +DOMException: Wrong Document Error @@ -49,7 +49,7 @@ Wrong Document Error -Wrong Document Error +DOMException: Wrong Document Error @@ -57,7 +57,7 @@ Wrong Document Error -Wrong Document Error +DOMException: Wrong Document Error @@ -65,7 +65,7 @@ Wrong Document Error -Wrong Document Error +DOMException: Wrong Document Error @@ -73,7 +73,7 @@ Wrong Document Error -Wrong Document Error +DOMException: Wrong Document Error diff --git a/ext/dom/tests/gh11830/hierarchy_variation.phpt b/ext/dom/tests/gh11830/hierarchy_variation.phpt index 443068461874..7a8322e1fd19 100644 --- a/ext/dom/tests/gh11830/hierarchy_variation.phpt +++ b/ext/dom/tests/gh11830/hierarchy_variation.phpt @@ -20,8 +20,8 @@ function test($method) { try { $testElement->$method($alone, $container); - } catch (\DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $doc->saveXML(); @@ -34,13 +34,13 @@ test("after"); test("replaceWith"); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/gh11830/type_variation.phpt b/ext/dom/tests/gh11830/type_variation.phpt index 76732775e6db..d2366b678a5e 100644 --- a/ext/dom/tests/gh11830/type_variation.phpt +++ b/ext/dom/tests/gh11830/type_variation.phpt @@ -17,42 +17,42 @@ $testElement = $doc->documentElement->firstElementChild->nextElementSibling->fir try { $doc->documentElement->firstElementChild->prepend($testElement, 0); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->append($testElement, true); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->before($testElement, null); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->after($testElement, new stdClass); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->replaceWith($testElement, []); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $doc->saveXML(); ?> --EXPECT-- -DOMElement::prepend(): Argument #2 must be of type DOMNode|string, int given -DOMElement::append(): Argument #2 must be of type DOMNode|string, bool given -DOMElement::before(): Argument #2 must be of type DOMNode|string, null given -DOMElement::after(): Argument #2 must be of type DOMNode|string, stdClass given -DOMElement::replaceWith(): Argument #2 must be of type DOMNode|string, array given +TypeError: DOMElement::prepend(): Argument #2 must be of type DOMNode|string, int given +TypeError: DOMElement::append(): Argument #2 must be of type DOMNode|string, bool given +TypeError: DOMElement::before(): Argument #2 must be of type DOMNode|string, null given +TypeError: DOMElement::after(): Argument #2 must be of type DOMNode|string, stdClass given +TypeError: DOMElement::replaceWith(): Argument #2 must be of type DOMNode|string, array given diff --git a/ext/dom/tests/gh12002.phpt b/ext/dom/tests/gh12002.phpt index 7d1ae944646a..2512aa7d23fb 100644 --- a/ext/dom/tests/gh12002.phpt +++ b/ext/dom/tests/gh12002.phpt @@ -15,24 +15,24 @@ $dom->encoding = make_nonconst('utf-8'); var_dump($dom->encoding); try { $dom->encoding = make_nonconst('foobar'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->encoding); $dom->encoding = make_nonconst('utf-16le'); var_dump($dom->encoding); try { $dom->encoding = NULL; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->encoding); ?> --EXPECT-- string(5) "utf-8" -Invalid document encoding +ValueError: Invalid document encoding string(5) "utf-8" string(8) "utf-16le" -Invalid document encoding +ValueError: Invalid document encoding string(8) "utf-16le" diff --git a/ext/dom/tests/gh13960.phpt b/ext/dom/tests/gh13960.phpt index fae628f49c07..0094c84eafb0 100644 --- a/ext/dom/tests/gh13960.phpt +++ b/ext/dom/tests/gh13960.phpt @@ -9,9 +9,9 @@ $domd = new DOMDocument(); $xp = new DOMXPath($domd); try { $xp->query("//foo[contains(text(), " . $xp->quote("tes\x00t") . ")]"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMXPath::quote(): Argument #1 ($str) must not contain any null bytes +ValueError: DOMXPath::quote(): Argument #1 ($str) must not contain any null bytes diff --git a/ext/dom/tests/gh15137.phpt b/ext/dom/tests/gh15137.phpt index c5ce1aca75be..6013cee2a566 100644 --- a/ext/dom/tests/gh15137.phpt +++ b/ext/dom/tests/gh15137.phpt @@ -8,4 +8,3 @@ var_dump(new DOMText()->wholeText); ?> --EXPECT-- string(0) "" - diff --git a/ext/dom/tests/gh15910.phpt b/ext/dom/tests/gh15910.phpt index c9b14a0b8663..249795c5a12e 100644 --- a/ext/dom/tests/gh15910.phpt +++ b/ext/dom/tests/gh15910.phpt @@ -10,9 +10,9 @@ $doc = new DOMDocument(); $doc->appendChild($doc->createElement('container')); try { $doc->documentElement->setAttributeNodeNS($doc); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMElement::setAttributeNodeNS(): Argument #1 ($attr) must be of type DOMAttr, DOMDocument given +TypeError: DOMElement::setAttributeNodeNS(): Argument #1 ($attr) must be of type DOMAttr, DOMDocument given diff --git a/ext/dom/tests/gh16039.phpt b/ext/dom/tests/gh16039.phpt index 48a862eda7b2..fc3f519e72c8 100644 --- a/ext/dom/tests/gh16039.phpt +++ b/ext/dom/tests/gh16039.phpt @@ -9,23 +9,23 @@ $dom = new DOMDocument; $element = $dom->appendChild($dom->createElement('root')); try { $element->prepend('x', new DOMEntity); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(); $dom->strictErrorChecking = false; // Should not have influence try { $element->prepend('x', new DOMEntity); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(); ?> --EXPECT-- -Invalid State Error +DOMException: Invalid State Error -Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/gh16151.phpt b/ext/dom/tests/gh16151.phpt index e11d3df4a56b..d2fd5d2915f1 100644 --- a/ext/dom/tests/gh16151.phpt +++ b/ext/dom/tests/gh16151.phpt @@ -13,13 +13,13 @@ $element->setAttributeNodeNS($attr); try { $attr->insertBefore(new DOMComment("h")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $attr->appendChild(new DOMComment("h")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $attr->insertBefore($doc->createEntityReference('amp')); @@ -29,7 +29,7 @@ echo $doc->saveXML(); ?> --EXPECT-- -Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error W diff --git a/ext/dom/tests/gh16190.phpt b/ext/dom/tests/gh16190.phpt index d3d83b5eb49d..2e1877862a54 100644 --- a/ext/dom/tests/gh16190.phpt +++ b/ext/dom/tests/gh16190.phpt @@ -9,10 +9,10 @@ $doc = Dom\XMLDocument::createEmpty(); $rm = new ReflectionMethod($doc, '__construct'); try { $rm->invoke($doc); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot directly construct Dom\XMLDocument, use document methods instead +Error: Cannot directly construct Dom\XMLDocument, use document methods instead diff --git a/ext/dom/tests/gh16316.phpt b/ext/dom/tests/gh16316.phpt index 43368746bc46..1ddf969ef598 100644 --- a/ext/dom/tests/gh16316.phpt +++ b/ext/dom/tests/gh16316.phpt @@ -12,14 +12,14 @@ class Demo extends DOMXPath { $demo = new Demo; try { var_dump($demo); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($demo->document); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -28,5 +28,5 @@ object(Demo)#1 (1) { ["registerNodeNamespaces"]=> bool(true) } -Invalid State Error -Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/gh16465.phpt b/ext/dom/tests/gh16465.phpt index b09f5de7dcc3..492f86833a73 100644 --- a/ext/dom/tests/gh16465.phpt +++ b/ext/dom/tests/gh16465.phpt @@ -8,22 +8,22 @@ dom $v10 = new DOMElement("a"); try { $v10->getElementsByTagName("text\0something"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $v10->getElementsByTagNameNS("", "text\0something"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $v10->getElementsByTagNameNS("text\0something", ""); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMElement::getElementsByTagName(): Argument #1 ($qualifiedName) must not contain any null bytes -DOMElement::getElementsByTagNameNS(): Argument #2 ($localName) must not contain any null bytes -DOMElement::getElementsByTagNameNS(): Argument #1 ($namespace) must not contain any null bytes +ValueError: DOMElement::getElementsByTagName(): Argument #1 ($qualifiedName) must not contain any null bytes +ValueError: DOMElement::getElementsByTagNameNS(): Argument #2 ($localName) must not contain any null bytes +ValueError: DOMElement::getElementsByTagNameNS(): Argument #1 ($namespace) must not contain any null bytes diff --git a/ext/dom/tests/gh16533.phpt b/ext/dom/tests/gh16533.phpt index dad40e88b4d1..45850f00b4f8 100644 --- a/ext/dom/tests/gh16533.phpt +++ b/ext/dom/tests/gh16533.phpt @@ -8,13 +8,13 @@ dom $doc = new DOMDocument(); try { $doc->appendChild($doc->createAttribute('foo')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $doc->saveXML(); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/gh16535.phpt b/ext/dom/tests/gh16535.phpt index adb1dfa91f20..0e743dd70c03 100644 --- a/ext/dom/tests/gh16535.phpt +++ b/ext/dom/tests/gh16535.phpt @@ -11,15 +11,15 @@ $v2->loadHTML("t"); $v4 = $v2->createElement('foo'); try { $v4->appendChild($v2); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $v2->loadHTML("

oU

"); echo $v2->saveXML(); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error

oU

diff --git a/ext/dom/tests/gh16593.phpt b/ext/dom/tests/gh16593.phpt index 416d794a4f0d..ed108513dce4 100644 --- a/ext/dom/tests/gh16593.phpt +++ b/ext/dom/tests/gh16593.phpt @@ -10,13 +10,13 @@ $root = $doc->appendChild($doc->createElement('root')); $child = $root->appendChild($doc->createElement('child')); try { $root->replaceChild($doc->createAttribute('foo'), $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $doc->saveXML(); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/gh16594.phpt b/ext/dom/tests/gh16594.phpt index adfde5948eef..aef53dd83f69 100644 --- a/ext/dom/tests/gh16594.phpt +++ b/ext/dom/tests/gh16594.phpt @@ -16,10 +16,10 @@ $v7->appendChild($v1); try { $v1->before($v6); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/gh16777_1.phpt b/ext/dom/tests/gh16777_1.phpt index d821842ace4e..be2dc88a0f46 100644 --- a/ext/dom/tests/gh16777_1.phpt +++ b/ext/dom/tests/gh16777_1.phpt @@ -13,12 +13,12 @@ echo $doc->saveXML(); $dom2 = new DOMDocument(); try { $dom2->appendChild($text); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- my value my new value -Wrong Document Error +DOMException: Wrong Document Error diff --git a/ext/dom/tests/gh16777_2.phpt b/ext/dom/tests/gh16777_2.phpt index a6f3a59621b4..b0f1506c8551 100644 --- a/ext/dom/tests/gh16777_2.phpt +++ b/ext/dom/tests/gh16777_2.phpt @@ -14,8 +14,8 @@ echo $doc->saveXML(); $dom2 = new DOMDocument(); try { $dom2->appendChild($el); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($child->ownerDocument === $doc); ?> @@ -23,5 +23,5 @@ var_dump($child->ownerDocument === $doc); -Wrong Document Error +DOMException: Wrong Document Error bool(true) diff --git a/ext/dom/tests/gh17847.phpt b/ext/dom/tests/gh17847.phpt index b2c4caff2fc7..625a041ce7d1 100644 --- a/ext/dom/tests/gh17847.phpt +++ b/ext/dom/tests/gh17847.phpt @@ -37,16 +37,16 @@ foreach ($xpath->query('//p') as $entry) { foreach ($garbage as $node) { try { var_dump($node->localName); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Invalid State Error -Invalid State Error -Invalid State Error -Invalid State Error -Invalid State Error -Invalid State Error -Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error +DOMException: Invalid State Error diff --git a/ext/dom/tests/modern/common/template_rename.phpt b/ext/dom/tests/modern/common/template_rename.phpt index a71126b21f22..04e1d8a00af3 100644 --- a/ext/dom/tests/modern/common/template_rename.phpt +++ b/ext/dom/tests/modern/common/template_rename.phpt @@ -19,8 +19,8 @@ var_dump($template->innerHTML); try { $template->rename($template->namespaceURI, 'screwthis'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // These shouldn't be changed! @@ -30,6 +30,6 @@ var_dump($template->innerHTML); ?> --EXPECT-- string(16) "a
foo
b" -It is not possible to rename the template element because it hosts a document fragment +DOMException: It is not possible to rename the template element because it hosts a document fragment string(8) "TEMPLATE" string(16) "a
foo
b" diff --git a/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt b/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt index 81db6a72b686..83940435a53d 100644 --- a/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt +++ b/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt @@ -9,10 +9,10 @@ $dom = DOM\XMLDocument::createFromString(""); try { var_dump($dom->documentElement->closest('@invalid')); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid selector (Selectors. Unexpected token: @invalid) +DOMException: Invalid selector (Selectors. Unexpected token: @invalid) diff --git a/ext/dom/tests/modern/css_selectors/combinators.phpt b/ext/dom/tests/modern/css_selectors/combinators.phpt index b43b07f59e82..02e026da7e52 100644 --- a/ext/dom/tests/modern/css_selectors/combinators.phpt +++ b/ext/dom/tests/modern/css_selectors/combinators.phpt @@ -56,8 +56,8 @@ test_helper($dom, 'article[title].bar p'); try { test_helper($dom, 'col.selected||td'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -110,4 +110,4 @@ try { --- Selector: article[title].bar p ---

Fifth p

--- Selector: col.selected||td --- -Dom\Document::querySelectorAll(): Argument #1 ($selectors) contains an unsupported selector +ValueError: Dom\Document::querySelectorAll(): Argument #1 ($selectors) contains an unsupported selector diff --git a/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt b/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt index 11cc4a942d24..936b9d541acd 100644 --- a/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt +++ b/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt @@ -9,10 +9,10 @@ $dom = DOM\XMLDocument::createFromString(""); try { var_dump($dom->documentElement->matches('@invalid')); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid selector (Selectors. Unexpected token: @invalid) +DOMException: Invalid selector (Selectors. Unexpected token: @invalid) diff --git a/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt b/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt index b1be7db685d4..acecf6903fe9 100644 --- a/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt +++ b/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt @@ -13,11 +13,11 @@ XML); try { test_helper($dom, ':blank'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- --- Selector: :blank --- -:blank selector is not implemented because CSSWG has not yet decided its semantics (https://github.com/w3c/csswg-drafts/issues/1967) +DOMException: :blank selector is not implemented because CSSWG has not yet decided its semantics (https://github.com/w3c/csswg-drafts/issues/1967) diff --git a/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt b/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt index 76bc6fbd0cf4..9a545dd767a0 100644 --- a/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt +++ b/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt @@ -9,17 +9,17 @@ $dom = DOM\XMLDocument::createEmpty(); $el = $dom->createElementNS("http://www.w3.org/1999/xhtml", "foo:bar"); try { $el->rename("urn:a", "foo:baz"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $el = $dom->createElementNS("urn:a", "foo:bar"); try { $el->rename("http://www.w3.org/1999/xhtml", "foo:baz"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -It is not possible to move an element out of the HTML namespace because the HTML namespace is tied to the HTMLElement class -It is not possible to move an element into the HTML namespace because the HTML namespace is tied to the HTMLElement class +DOMException: It is not possible to move an element out of the HTML namespace because the HTML namespace is tied to the HTMLElement class +DOMException: It is not possible to move an element into the HTML namespace because the HTML namespace is tied to the HTMLElement class diff --git a/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt b/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt index a63437ebd80d..4a7d5007ea4c 100644 --- a/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt +++ b/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt @@ -19,38 +19,38 @@ XML, LIBXML_DTDATTR); $root = $dom->documentElement; try { $root->attributes[0]->rename(NULL, 'c'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[0]->rename(NULL, 'c'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[1]->rename(NULL, 'a'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[1]->rename('urn:a', 'foo'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[3]->rename('', 'a'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->firstElementChild->attributes[0]->rename(NULL, 'hello'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->firstElementChild->attributes[1]->rename(NULL, 'my-attr'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // This is here to validate that nothing actually changed @@ -58,12 +58,12 @@ echo $dom->saveXML(); ?> --EXPECT-- -An attribute with the given name in the given namespace already exists -An attribute with the given name in the given namespace already exists -An attribute with the given name in the given namespace already exists -An attribute with the given name in the given namespace already exists -An attribute with the given name in the given namespace already exists -An attribute with the given name in the given namespace already exists +DOMException: An attribute with the given name in the given namespace already exists +DOMException: An attribute with the given name in the given namespace already exists +DOMException: An attribute with the given name in the given namespace already exists +DOMException: An attribute with the given name in the given namespace already exists +DOMException: An attribute with the given name in the given namespace already exists +DOMException: An attribute with the given name in the given namespace already exists diff --git a/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt b/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt index 5f899c8e814d..2dcd71d25547 100644 --- a/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt +++ b/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt @@ -9,21 +9,21 @@ $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->rename('', 'a:b'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->documentElement->rename('urn:a', 'a:b:c'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(); ?> --EXPECT-- -Namespace Error -Invalid Character Error +DOMException: Namespace Error +DOMException: Invalid Character Error diff --git a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt index 6b87f1d4714a..12115e2e16a9 100644 --- a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt +++ b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt @@ -7,8 +7,8 @@ dom try { Dom\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // The override encoding matches with the document encoding attribute @@ -23,7 +23,7 @@ var_dump($dom->charset); ?> --EXPECT-- -Dom\HTMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding +ValueError: Dom\HTMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding string(20) " Héllo, world! " diff --git a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt index 75984d6acd97..43be0bcea45f 100644 --- a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt +++ b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt @@ -7,8 +7,8 @@ dom try { Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // The override encoding matches with the document encoding attribute @@ -23,7 +23,7 @@ var_dump($dom->charset); ?> --EXPECT-- -Dom\HTMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding +ValueError: Dom\HTMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding string(20) " Héllo, world! " diff --git a/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt b/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt index c4417d804108..b2869676c7a6 100644 --- a/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt +++ b/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt @@ -11,33 +11,33 @@ $dom->inputEncoding = "CSeuckr"; var_dump($dom->characterSet); try { $dom->charset = "nope"; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->charset); $dom->inputEncoding = "Windows-1251"; var_dump($dom->characterSet); try { $dom->charset = ""; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->inputEncoding); echo $dom->saveHtml(); try { $dom = Dom\HTMLDocument::createEmpty("bogus"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(5) "UTF-8" string(6) "EUC-KR" -Invalid document encoding +ValueError: Invalid document encoding string(6) "EUC-KR" string(12) "windows-1251" -Invalid document encoding +ValueError: Invalid document encoding string(12) "windows-1251" -Dom\HTMLDocument::createEmpty(): Argument #1 ($encoding) must be a valid document encoding +ValueError: Dom\HTMLDocument::createEmpty(): Argument #1 ($encoding) must be a valid document encoding diff --git a/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt b/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt index 1f934fcff890..b978eddf1da9 100644 --- a/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt +++ b/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt @@ -12,7 +12,7 @@ function testNormalReplace($cb) try { $dom->body = $cb($dom); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->body?->nodeName); } @@ -33,8 +33,8 @@ echo "--- Set body without document element ---\n"; $dom = DOM\XMLDocument::createEmpty(); try { $dom->body = $dom->createElementNS("http://www.w3.org/1999/xhtml", "body"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->body?->nodeName); @@ -42,20 +42,20 @@ var_dump($dom->body?->nodeName); --EXPECT-- --- Set body to NULL --- string(4) "BODY" -The new body must either be a body or a frameset tag +DOMException: The new body must either be a body or a frameset tag string(4) "BODY" --- Wrong element tag in right namespace --- string(4) "BODY" -The new body must either be a body or a frameset tag +DOMException: The new body must either be a body or a frameset tag string(4) "BODY" --- Right element tag in wrong namespace --- string(4) "BODY" -Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement +TypeError: Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement string(4) "BODY" --- Right element tag in no namespace --- string(4) "BODY" -Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement +TypeError: Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement string(4) "BODY" --- Set body without document element --- -A body can only be set if there is a document element +DOMException: A body can only be set if there is a document element NULL diff --git a/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt b/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt index b8e13ba436b6..a0b03df695c8 100644 --- a/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt +++ b/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt @@ -12,16 +12,16 @@ echo "--- BeforeBegin no parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::BeforeBegin, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- AfterEnd no parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::AfterEnd, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom->appendChild($element); @@ -30,25 +30,25 @@ echo "--- BeforeBegin document parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::BeforeBegin, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- AfterEnd document parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::AfterEnd, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- --- BeforeBegin no parent --- -No Modification Allowed Error +DOMException: No Modification Allowed Error --- AfterEnd no parent --- -No Modification Allowed Error +DOMException: No Modification Allowed Error --- BeforeBegin document parent --- -No Modification Allowed Error +DOMException: No Modification Allowed Error --- AfterEnd document parent --- -No Modification Allowed Error +DOMException: No Modification Allowed Error diff --git a/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt b/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt index 571f94e4d340..1554e9e582fa 100644 --- a/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt +++ b/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt @@ -9,24 +9,24 @@ $dom = Dom\XMLDocument::createFromString(''); try { $dom->getElementsByTagName('root')[][1] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->getElementsByTagName('root')[true]; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($dom->getElementsByTagName('root')[true]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot append to Dom\HTMLCollection -Cannot access offset of type bool on Dom\HTMLCollection -Cannot access offset of type bool in isset or empty +Error: Cannot append to Dom\HTMLCollection +TypeError: Cannot access offset of type bool on Dom\HTMLCollection +TypeError: Cannot access offset of type bool in isset or empty diff --git a/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt b/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt index 70be58a906ba..04eceb443455 100644 --- a/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt +++ b/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt @@ -13,8 +13,8 @@ class Custom extends Dom\Document { $dom = Dom\HTMLDocument::createEmpty(); try { $dom->registerNodeClass("Dom\\Document", "Custom"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $element = $dom->appendChild($dom->createElement("foo")); @@ -27,7 +27,7 @@ $element->ownerDocument->foo(); ?> --EXPECTF-- -Dom\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class +ValueError: Dom\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class string(16) "Dom\HTMLDocument" Fatal error: Uncaught Error: Call to undefined method Dom\HTMLDocument::foo() in %s:%d diff --git a/ext/dom/tests/modern/html/interactions/without_constructor.phpt b/ext/dom/tests/modern/html/interactions/without_constructor.phpt index 96cd131b0391..be491c66fbbc 100644 --- a/ext/dom/tests/modern/html/interactions/without_constructor.phpt +++ b/ext/dom/tests/modern/html/interactions/without_constructor.phpt @@ -9,12 +9,12 @@ foreach (['Dom\HTMLDocument', 'Dom\XMLDocument'] as $class) { try { $rc = new ReflectionClass($class); $rc->newInstanceWithoutConstructor(); - } catch (ReflectionException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Class Dom\HTMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor -Class Dom\XMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor +ReflectionException: Class Dom\HTMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor +ReflectionException: Class Dom\XMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor diff --git a/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt b/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt index 37cf161ec045..398a927ad177 100644 --- a/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt +++ b/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt @@ -7,16 +7,16 @@ dom try { Dom\HTMLDocument::createFromFile("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Dom\HTMLDocument::createFromFile('%00'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain any null bytes -Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes +ValueError: Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain any null bytes +ValueError: Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes diff --git a/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt b/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt index f61ef2dec867..f3f00b581718 100644 --- a/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt +++ b/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt @@ -31,8 +31,8 @@ foreach (["createFromString", "createFromFile"] as $method) { var_dump($options); try { Dom\HTMLDocument::{$method}("x", $options); - } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -41,67 +41,67 @@ foreach (["createFromString", "createFromFile"] as $method) { --EXPECTF-- --- Method createFromString --- int(%d) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4194304) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(524288) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(8) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(16) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(256) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(16384) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(2) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(1024) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(1) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(2048) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(64) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(128) -Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) --- Method createFromFile --- int(%d) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4194304) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(524288) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(8) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(16) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(256) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(16384) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(4) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(2) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(1024) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(1) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(2048) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(64) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) int(128) -Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) +ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS) diff --git a/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt b/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt index f29a201ca106..0cefe145ead1 100644 --- a/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt @@ -18,8 +18,8 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { $comment->deleteData(3, -1); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; @@ -28,5 +28,5 @@ echo $dom->saveHtml($comment), "\n"; --- Modern behaviour --- --- Legacy behaviour --- -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt b/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt index 9369bdadbffa..1aaf24a8969e 100644 --- a/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt @@ -11,18 +11,18 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { var_dump($comment->insertData(100, "data")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($comment->insertData(2**31+1, "data")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; ?> --EXPECT-- -Index Size Error -Index Size Error +DOMException: Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt index f00e9aa76aae..c024c876dc7b 100644 --- a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt @@ -9,8 +9,8 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { $comment->insertData(-1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; $comment->insertData(1, "A"); @@ -18,6 +18,6 @@ echo $dom->saveHtml($comment), "\n"; ?> --EXPECT-- -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt index 7c27c3bc8dd5..c2feefd45ab0 100644 --- a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt @@ -15,8 +15,8 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { $comment->insertData(-1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; $comment->insertData(-(2**32 - 1), "A"); @@ -28,25 +28,25 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { $comment->insertData(-1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; try { $comment->insertData(-(2**32 - 1), "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; ?> --EXPECT-- --- Modern behaviour --- -Index Size Error +DOMException: Index Size Error --- Legacy behaviour --- -Index Size Error +DOMException: Index Size Error -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt b/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt index 64634b099257..a85587c7d262 100644 --- a/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt @@ -25,14 +25,14 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { $comment->replaceData(0, -1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; try { $comment->replaceData(2, -(2**32 - 2), "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; @@ -42,7 +42,7 @@ echo $dom->saveHtml($comment), "\n"; --- Legacy behaviour --- -Index Size Error +DOMException: Index Size Error -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt b/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt index c463c0f7057c..e7f81f765dbe 100644 --- a/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt @@ -11,24 +11,24 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { var_dump($comment->substringData(0, 2**31+1)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($comment->substringData(2**31+1, 0)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($comment->substringData(100, 0)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; ?> --EXPECT-- -Index Size Error -Index Size Error -Index Size Error +DOMException: Index Size Error +DOMException: Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt index 28198d94d6d5..5e980a1521b6 100644 --- a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt @@ -13,8 +13,8 @@ var_dump($comment->substringData(2, -2)); echo $dom->saveHtml($comment), "\n"; try { var_dump($comment->substringData(-2, 2)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; @@ -24,5 +24,5 @@ string(9) "foobarbaz" string(7) "obarbaz" -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt index 7d38bd28d441..ef85193c35cb 100644 --- a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt @@ -26,20 +26,20 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { var_dump($comment->substringData(0, -1)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; try { var_dump($comment->substringData(2, -(2**32 - 2))); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; try { var_dump($comment->substringData(-(2**32 - 2), 2)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; @@ -53,9 +53,9 @@ string(2) "ob" string(2) "ob" --- Legacy behaviour --- -Index Size Error +DOMException: Index Size Error -Index Size Error +DOMException: Index Size Error -Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt b/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt index 6441ee60ef4f..58f8b3e3e910 100644 --- a/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt +++ b/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt @@ -10,9 +10,9 @@ require __DIR__ . '/dump_attr.inc'; function testErrorCase($dom, $ns, $qname) { try { $dom->createAttributeNS($ns, $qname); - } catch (DOMException $e) { + } catch (Throwable $e) { $ns_readable = is_null($ns) ? 'null' : "\"$ns\""; - echo "($ns_readable, \"$qname\"): {$e->getMessage()}\n"; + echo "($ns_readable, \"$qname\"): ", $e::class, ': ', $e->getMessage(), "\n"; } } @@ -68,13 +68,13 @@ echo $dom->saveHtml(), "\n"; ?> --EXPECT-- --- Error cases --- -("", "bar:bar"): Namespace Error -(null, "bar:bar"): Namespace Error -("urn:a", "@"): Invalid Character Error -("urn:a", "foo:bar:baz"): Invalid Character Error -("http://www.w3.org/2000/xmlns", "xmlns"): Namespace Error -("http://www.w3.org/2000/xmlns", "xmlns:bar"): Namespace Error -("http://www.w3.org/2000/xmlns", "xml:foo"): Namespace Error +("", "bar:bar"): DOMException: Namespace Error +(null, "bar:bar"): DOMException: Namespace Error +("urn:a", "@"): DOMException: Invalid Character Error +("urn:a", "foo:bar:baz"): DOMException: Invalid Character Error +("http://www.w3.org/2000/xmlns", "xmlns"): DOMException: Namespace Error +("http://www.w3.org/2000/xmlns", "xmlns:bar"): DOMException: Namespace Error +("http://www.w3.org/2000/xmlns", "xml:foo"): DOMException: Namespace Error --- Normal cases --- Attr: xmlns:foo diff --git a/ext/dom/tests/modern/spec/Document_createElementNS.phpt b/ext/dom/tests/modern/spec/Document_createElementNS.phpt index cbdbe5dfd983..050b46d03e2b 100644 --- a/ext/dom/tests/modern/spec/Document_createElementNS.phpt +++ b/ext/dom/tests/modern/spec/Document_createElementNS.phpt @@ -32,8 +32,8 @@ function testError($dom, $namespaceURI, $qualifiedName) echo "($ns_readable, \"$qualifiedName\"): "; try { $dom->createElementNS($namespaceURI, $qualifiedName); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -89,8 +89,8 @@ namespaceURI: string(36) "http://www.w3.org/XML/1998/namespace" &hello --- Error cases --- -(NULL, "prefix:name"): Namespace Error -("", "prefix:name"): Namespace Error -("urn:foo", "@"): Invalid Character Error -("http://www.w3.org/2000/xmlns/", "svg"): Namespace Error -("urn:foo", "xml:xml"): Namespace Error +(NULL, "prefix:name"): DOMException: Namespace Error +("", "prefix:name"): DOMException: Namespace Error +("urn:foo", "@"): DOMException: Invalid Character Error +("http://www.w3.org/2000/xmlns/", "svg"): DOMException: Namespace Error +("urn:foo", "xml:xml"): DOMException: Namespace Error diff --git a/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt b/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt index 6d8fc878b6ce..ac31650f03fb 100644 --- a/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt @@ -8,16 +8,16 @@ dom $dom = Dom\HTMLDocument::createEmpty(); try { $dom->createElement(''); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createElement('$'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid Character Error -Invalid Character Error +DOMException: Invalid Character Error +DOMException: Invalid Character Error diff --git a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt index 74e17fb5a4f0..bddf79c395c0 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt @@ -8,22 +8,22 @@ dom $dom = Dom\XMLDocument::createEmpty(); try { $dom->implementation->createDocumentType("invalid name", "public", "system"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->implementation->createDocumentType("", "public", "system"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->implementation->createDocumentType("@", "", ""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Namespace Error -Namespace Error -Namespace Error +DOMException: Namespace Error +DOMException: Namespace Error +DOMException: Namespace Error diff --git a/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt b/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt index 673aed3ef556..b43762459883 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt @@ -9,17 +9,17 @@ $dom = Dom\XMLDocument::createEmpty(); try { $dom->implementation->createDocument("urn:a", "@"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->implementation->createDocument("", "foo:bar"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid Character Error -Namespace Error +DOMException: Invalid Character Error +DOMException: Namespace Error diff --git a/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt b/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt index 690b2bf63584..bcc735ab7c29 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt @@ -17,8 +17,8 @@ var_dump($implementation); try { clone $implementation; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -28,4 +28,4 @@ bool(true) bool(false) object(Dom\Implementation)#2 (0) { } -Trying to clone an uncloneable object of class Dom\Implementation +Error: Trying to clone an uncloneable object of class Dom\Implementation diff --git a/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt b/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt index 9f02411fd8bb..7367e9fdcfd8 100644 --- a/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt +++ b/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt @@ -13,12 +13,12 @@ var_dump($dom->importNode($dom)); $dom = Dom\HTMLDocument::createEmpty(); try { $dom->importNode($dom); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: DOMDocument::importNode(): Cannot import: Node Type Not Supported in %s on line %d bool(false) -Not Supported Error +DOMException: Not Supported Error diff --git a/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt b/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt index ef466817de89..90eb1570b420 100644 --- a/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt +++ b/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt @@ -9,8 +9,8 @@ $dom = Dom\HTMLDocument::createEmpty(); $foo = $dom->appendChild($dom->createElement("foo")); try { $foo->insertAdjacentText(Dom\AdjacentPosition::BeforeBegin, "bar"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->insertAdjacentText(Dom\AdjacentPosition::AfterBegin, "bar"); @@ -23,7 +23,7 @@ var_dump($foo->firstChild->nextSibling->textContent); ?> --EXPECT-- -Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document barbaz string(3) "bar" string(3) "baz" diff --git a/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt b/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt index cb623f702983..79119f19769f 100644 --- a/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt +++ b/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt @@ -8,11 +8,11 @@ $dom = Dom\HTMLDocument::createEmpty(); $div = $dom->createElement('div'); try { $div->prefix = "foo"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXml(); ?> --EXPECT-- -Cannot modify private(set) property Dom\Element::$prefix from global scope +Error: Cannot modify private(set) property Dom\Element::$prefix from global scope diff --git a/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt b/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt index e50ef36e31fa..9a5661b967f8 100644 --- a/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt @@ -8,10 +8,10 @@ dom $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->removeAttributeNode($dom->createAttribute('test')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt b/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt index a38048a47ce9..1baacee26136 100644 --- a/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt +++ b/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt @@ -20,8 +20,8 @@ echo "--- name validation ---\n"; try { $container->setAttributeNS("urn:a", "a:b:c", ""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- ns attributes with same namespace but different prefix ---\n"; @@ -53,7 +53,7 @@ string(5) "xmlns" string(9) "xmlns:foo" string(29) "http://www.w3.org/2000/xmlns/" --- name validation --- -Invalid Character Error +DOMException: Invalid Character Error --- ns attributes with same namespace but different prefix --- Attr: y:foo diff --git a/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt b/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt index f6509c07a192..a83c09b0c70a 100644 --- a/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt +++ b/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt @@ -13,12 +13,12 @@ $container->setAttributeNode($attr1); $element = $container->appendChild($dom1->createElement("element")); try { $element->setAttributeNode($attr1); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom1->saveHtml(), "\n"; ?> --EXPECT-- -In Use Attribute Error +DOMException: In Use Attribute Error diff --git a/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt b/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt index 1787ae29f95d..fb02c20c7596 100644 --- a/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt +++ b/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt @@ -7,30 +7,30 @@ dom $dom = Dom\HTMLDocument::createEmpty(); try { $dom->createCDATASection("foo"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createCDATASection("]]>"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createEmpty(); try { $dom->createCDATASection("]]>"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom->createCDATASection("]>"); ?> --EXPECT-- int(9) -This operation is not supported for HTML documents +DOMException: This operation is not supported for HTML documents int(9) -This operation is not supported for HTML documents +DOMException: This operation is not supported for HTML documents int(5) -Invalid character sequence "]]>" in CDATA section +DOMException: Invalid character sequence "]]>" in CDATA section diff --git a/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt b/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt index f1a60b875b1d..23c8e0a0d7bc 100644 --- a/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt +++ b/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt @@ -7,21 +7,21 @@ dom $dom = Dom\HTMLDocument::createEmpty(); try { $dom->createProcessingInstruction("?>", ""); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createProcessingInstruction("?>", "?>"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createProcessingInstruction("target", "?>"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom->appendChild($dom->createProcessingInstruction("foo", "")); $dom->appendChild($dom->createProcessingInstruction("foo", "bar")); @@ -29,9 +29,9 @@ echo $dom->saveHtml(); ?> --EXPECT-- int(5) -Invalid Character Error +DOMException: Invalid Character Error int(5) -Invalid Character Error +DOMException: Invalid Character Error int(5) -Invalid character sequence "?>" in processing instruction +DOMException: Invalid character sequence "?>" in processing instruction diff --git a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt index cf446881559b..c2f8f4ba5556 100644 --- a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt +++ b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt @@ -14,8 +14,8 @@ foreach ($test_values as $value) { echo "--- ", json_encode($value), " ---\n"; try { var_dump($attributes[$value] ? $attributes[$value]->nodeName : "N/A", isset($attributes[$value]), empty($attributes[$value])); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -58,9 +58,9 @@ string(1) "b" bool(true) bool(false) --- true --- -Cannot access offset of type bool on Dom\NamedNodeMap +TypeError: Cannot access offset of type bool on Dom\NamedNodeMap --- null --- -Cannot access offset of type null on Dom\NamedNodeMap +TypeError: Cannot access offset of type null on Dom\NamedNodeMap --- "0" --- string(1) "a" bool(true) diff --git a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt index 848b1a2c0b02..c6a18db43730 100644 --- a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt +++ b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt @@ -10,10 +10,10 @@ $attributes = $dom->documentElement->attributes; try { $attributes[][0] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot append to Dom\NamedNodeMap +Error: Cannot append to Dom\NamedNodeMap diff --git a/ext/dom/tests/modern/spec/NodeList_dimensions.phpt b/ext/dom/tests/modern/spec/NodeList_dimensions.phpt index f5fe6480e641..710a48b6069b 100644 --- a/ext/dom/tests/modern/spec/NodeList_dimensions.phpt +++ b/ext/dom/tests/modern/spec/NodeList_dimensions.phpt @@ -14,8 +14,8 @@ foreach ($test_values as $value) { echo "--- ", json_encode($value), " ---\n"; try { var_dump($children[$value] ? $children[$value]->nodeName : "N/A", isset($children[$value]), empty($children[$value])); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -58,9 +58,9 @@ string(1) "b" bool(true) bool(false) --- true --- -Cannot access offset of type bool on Dom\NodeList +TypeError: Cannot access offset of type bool on Dom\NodeList --- null --- -Cannot access offset of type null on Dom\NodeList +TypeError: Cannot access offset of type null on Dom\NodeList --- "0" --- string(1) "a" bool(true) @@ -70,6 +70,6 @@ string(1) "b" bool(true) bool(false) --- "" --- -Cannot access offset of type string on Dom\NodeList +TypeError: Cannot access offset of type string on Dom\NodeList --- "foo" --- -Cannot access offset of type string on Dom\NodeList +TypeError: Cannot access offset of type string on Dom\NodeList diff --git a/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt b/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt index bfb882823b78..d5c84550b825 100644 --- a/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt +++ b/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt @@ -10,10 +10,10 @@ $children = $dom->documentElement->childNodes; try { $children[][0] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot append to Dom\NodeList +Error: Cannot append to Dom\NodeList diff --git a/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt b/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt index 3e3a5674c6a6..d0b422cb4f7b 100644 --- a/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt +++ b/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt @@ -12,13 +12,13 @@ $attr = $dom->createAttribute('bar'); $attr->value = "hello"; try { $element->appendChild($attr); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($attr->value); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error string(5) "hello" diff --git a/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt b/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt index fc62d89811b5..3a1cd004bcbf 100644 --- a/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt +++ b/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt @@ -13,13 +13,13 @@ $fragment->appendChild($dom->createElement('bar')); try { $dom->appendChild($fragment); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXml($fragment), "\n"; ?> --EXPECT-- -Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document diff --git a/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt b/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt index af99bfc38057..d62df916f3c5 100644 --- a/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt +++ b/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt @@ -14,31 +14,31 @@ $attr = $dom->createAttribute('Hello'); try { $text->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $cdata->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $pi->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $attr->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt b/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt index 7894aa0a3131..e9352b028254 100644 --- a/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt +++ b/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt @@ -12,10 +12,10 @@ $dom->appendChild($dom->createElement("foo")); try { $dom->prepend($dom->createElement("bar")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document diff --git a/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt b/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt index 967334bbeba2..85527ad89e83 100644 --- a/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt +++ b/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt @@ -13,13 +13,13 @@ $fragment->appendChild($dom->createElement('a')); try { $dom->insertBefore($fragment, $dom->doctype); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml(), "\n"; ?> --EXPECT-- -Document types must be the first child in a document +DOMException: Document types must be the first child in a document diff --git a/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt b/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt index 390dba0f176a..df616b940353 100644 --- a/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt +++ b/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt @@ -12,13 +12,13 @@ $fragment->appendChild($dom->createElement('a')); try { $dom->insertBefore($fragment, $dom->documentElement); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml(), "\n"; ?> --EXPECT-- -Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document diff --git a/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt b/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt index afa6d1e8a815..b35b5f0d7d57 100644 --- a/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt @@ -17,30 +17,30 @@ echo "--- Wrong parent node type ---\n"; $comment = $dom->createComment('This is a comment'); try { $comment->replaceChild($comment, $dom->createElement("old-child")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Node is an inclusive ancestor of parent ---\n"; try { $parent->replaceChild($parent, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $parent->replaceChild($dom, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Child's parent is not parent ---\n"; try { $parent->replaceChild($dom->createElement("new-child"), $dom->createElement("old-child")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Invalid child to replace with ---\n"; @@ -48,24 +48,24 @@ echo "--- Invalid child to replace with ---\n"; try { $entityReference = $dom->importNode(Dom\XMLDocument::createEmpty()->createEntityReference("foo")); $parent->replaceChild($entityReference, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace element with text in document root ---\n"; try { $dom->replaceChild($dom->createTextNode("text"), $parent); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace child element with doctype inside element ---\n"; try { $parent->replaceChild($dom->doctype, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace element with fragment containing multiple elements ---\n"; @@ -76,8 +76,8 @@ $fragment->appendChild($dom->createElement("new-child2")); try { $dom->replaceChild($fragment, $parent); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace comment in document causing more than two elements ---\n"; @@ -85,24 +85,24 @@ echo "--- Replace comment in document causing more than two elements ---\n"; $comment = $dom->appendChild($dom->createComment("comment")); try { $dom->replaceChild($dom->createElement("new-child"), $comment); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace dtd with element ---\n"; try { $dom->replaceChild($dom->createElement("new-child"), $dom->doctype); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace element with another dtd ---\n"; try { $dom->replaceChild($dom->doctype, $parent); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace parent with itself ---\n"; @@ -120,26 +120,26 @@ echo $dom->saveHtml(), "\n"; ?> --EXPECT-- --- Wrong parent node type --- -Hierarchy Request Error +DOMException: Hierarchy Request Error --- Node is an inclusive ancestor of parent --- -Hierarchy Request Error -Hierarchy Request Error +DOMException: Hierarchy Request Error +DOMException: Hierarchy Request Error --- Child's parent is not parent --- -Not Found Error +DOMException: Not Found Error --- Invalid child to replace with --- -Hierarchy Request Error +DOMException: Hierarchy Request Error --- Replace element with text in document root --- -Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document --- Replace child element with doctype inside element --- -Cannot insert a document type into anything other than a document +DOMException: Cannot insert a document type into anything other than a document --- Replace element with fragment containing multiple elements --- -Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document --- Replace comment in document causing more than two elements --- -Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document --- Replace dtd with element --- -Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document --- Replace element with another dtd --- -Document types must be the first child in a document +DOMException: Document types must be the first child in a document --- Replace parent with itself --- --- Replace parent with single-child fragment --- diff --git a/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt b/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt index a88b4fc808b0..3a2af3d44780 100644 --- a/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt +++ b/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt @@ -10,14 +10,14 @@ $fragment->append($element = $dom->createElement("foo")); $fragment->append($dom->createElement("bar")); try { $dom->append($fragment); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($element->parentNode); ?> --EXPECT-- -Exception: Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document object(Dom\DocumentFragment)#2 (18) { ["children"]=> string(22) "(object value omitted)" diff --git a/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt b/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt index 367f1437c67d..302b9a8032c6 100644 --- a/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt +++ b/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt @@ -9,10 +9,10 @@ $dom = Dom\HTMLDocument::createEmpty(); $container = $dom->createElement('container'); try { $container->append($dom); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt b/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt index f81450ca261e..1e58ad9afa95 100644 --- a/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt +++ b/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt @@ -9,21 +9,21 @@ $dom = Dom\HTMLDocument::createEmpty(); try { $dom->append("bar"); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append($dom->createTextNode("bar")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $text = $dom->createTextNode("bar"); try { $dom->append($text); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($text->parentNode); @@ -33,15 +33,15 @@ $element = $dom->createElement("container"); $text = $element->appendChild($dom->createTextNode("text")); try { $dom->append($text); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Cannot insert text as a child of a document -Exception: Cannot insert text as a child of a document -Exception: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document NULL string(3) "bar" -Exception: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document diff --git a/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt b/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt index 4bd79b9b4a8b..41785ee7b9c2 100644 --- a/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt +++ b/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt @@ -9,16 +9,16 @@ $text = $dom->createTextNode('Hello World!'); var_dump($text->splitText(5)->wholeText); try { var_dump($text->splitText(-1)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->splitText(200)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(7) " World!" -Dom\Text::splitText(): Argument #1 ($offset) must be greater than or equal to 0 -Index Size Error +ValueError: Dom\Text::splitText(): Argument #1 ($offset) must be greater than or equal to 0 +DOMException: Index Size Error diff --git a/ext/dom/tests/modern/spec/XMLDocument_version.phpt b/ext/dom/tests/modern/spec/XMLDocument_version.phpt index 82f38839ea27..125c8027ba76 100644 --- a/ext/dom/tests/modern/spec/XMLDocument_version.phpt +++ b/ext/dom/tests/modern/spec/XMLDocument_version.phpt @@ -11,8 +11,8 @@ var_dump($dom->xmlVersion); foreach (['0.1', '1.0', '1.1', '', 'foo'] as $version) { try { $dom->xmlVersion = $version; - } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->xmlVersion); } @@ -20,11 +20,11 @@ foreach (['0.1', '1.0', '1.1', '', 'foo'] as $version) { ?> --EXPECT-- string(3) "1.0" -Invalid XML version +ValueError: Invalid XML version string(3) "1.0" string(3) "1.0" string(3) "1.1" -Invalid XML version +ValueError: Invalid XML version string(3) "1.1" -Invalid XML version +ValueError: Invalid XML version string(3) "1.1" diff --git a/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt b/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt index 20a69b3b545d..673d2b3519b9 100644 --- a/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt +++ b/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt @@ -24,15 +24,15 @@ $other->appendChild($doctype); $other->appendChild($doctype); try { $other->appendChild($other->implementation->createDocumentType('doc', '', '')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $other->saveXml(); ?> --EXPECT-- Found entity: foo -A document may only contain one document type +DOMException: A document may only contain one document type diff --git a/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt b/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt index ea530d675c3c..ffa90a3bd9d2 100644 --- a/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt +++ b/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt @@ -9,20 +9,20 @@ $dom = Dom\HTMLDocument::createEmpty(); try { $dom->append("foo", "bar", "baz", $dom); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append("foo", "bar", "baz"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHtml()); ?> --EXPECT-- -Hierarchy Request Error -Cannot insert text as a child of a document +DOMException: Hierarchy Request Error +DOMException: Cannot insert text as a child of a document string(0) "" diff --git a/ext/dom/tests/modern/spec/documentURI_URL.phpt b/ext/dom/tests/modern/spec/documentURI_URL.phpt index 3e5a797eae67..3ec21156b44d 100644 --- a/ext/dom/tests/modern/spec/documentURI_URL.phpt +++ b/ext/dom/tests/modern/spec/documentURI_URL.phpt @@ -13,8 +13,8 @@ try { $dom->URL = NULL; var_dump($dom->documentURI); var_dump($dom->URL); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom->URL = ""; @@ -29,7 +29,7 @@ var_dump($dom->URL); --EXPECTF-- string(%d) "%s" string(%d) "%s" -Cannot assign null to property Dom\Document::$URL of type string +TypeError: Cannot assign null to property Dom\Document::$URL of type string string(0) "" string(0) "" string(%d) "%s" diff --git a/ext/dom/tests/modern/spec/pre_insertion_validation.phpt b/ext/dom/tests/modern/spec/pre_insertion_validation.phpt index d16e3ffad9d9..67c464a3bddf 100644 --- a/ext/dom/tests/modern/spec/pre_insertion_validation.phpt +++ b/ext/dom/tests/modern/spec/pre_insertion_validation.phpt @@ -12,18 +12,18 @@ echo "--- Trying to insert text node into the document ---\n"; try { $dom->append("foo", "bar", "baz"); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append($dom->createTextNode("text node")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append($dom->createCDATASection("text node")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Trying to insert doctype into not a document ---\n"; @@ -31,16 +31,16 @@ echo "--- Trying to insert doctype into not a document ---\n"; $element = $dom->createElement("foo"); try { $element->append($doctype); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Trying to insert doctype at the wrong place in a document ---\n"; try { $dom->append($doctype); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Prepend doctype in a document should work ---\n"; @@ -51,8 +51,8 @@ echo "--- Trying to create multiple document roots ---\n"; try { $dom->append($dom->createElement("foo")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Trying to insert an element before a document type ---\n"; @@ -60,8 +60,8 @@ echo "--- Trying to insert an element before a document type ---\n"; $dom->documentElement->remove(); try { $dom->prepend($element); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Document output ---\n"; @@ -76,8 +76,8 @@ $fragment->append($dom->createElement("foo")); $fragment->append($dom->createElement("bar")); try { $dom->append($fragment); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Document fragment edge cases with text ---\n"; @@ -88,30 +88,30 @@ $fragment->append("foo"); $fragment->append($dom->createCDATASection("bar")); try { $dom->append($fragment); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- --- Trying to insert text node into the document --- -Exception: Cannot insert text as a child of a document -Exception: Cannot insert text as a child of a document -Exception: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document --- Trying to insert doctype into not a document --- -Exception: Cannot insert a document type into anything other than a document +DOMException: Cannot insert a document type into anything other than a document --- Trying to insert doctype at the wrong place in a document --- -Exception: Document types must be the first child in a document +DOMException: Document types must be the first child in a document --- Prepend doctype in a document should work --- --- Trying to create multiple document roots --- -Exception: Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document --- Trying to insert an element before a document type --- -Exception: Document types must be the first child in a document +DOMException: Document types must be the first child in a document --- Document output --- --- Document fragment edge cases with multiple elements --- -Exception: Cannot have more than one element child in a document +DOMException: Cannot have more than one element child in a document --- Document fragment edge cases with text --- -Exception: Cannot insert text as a child of a document +DOMException: Cannot insert text as a child of a document diff --git a/ext/dom/tests/modern/spec/textContent_edge_cases.phpt b/ext/dom/tests/modern/spec/textContent_edge_cases.phpt index 2252013c7a3f..cc26feea8fe7 100644 --- a/ext/dom/tests/modern/spec/textContent_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/textContent_edge_cases.phpt @@ -11,8 +11,8 @@ echo "document text content: "; var_dump($dom->textContent); try { $dom->textContent = "foo"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $container = $dom->documentElement; @@ -39,7 +39,7 @@ echo $dom->saveXml(), "\n"; ?> --EXPECT-- document text content: NULL -Cannot modify readonly property Dom\XMLDocument::$textContent +Error: Cannot modify readonly property Dom\XMLDocument::$textContent text node text content: string(4) "text" pi node text content: string(5) "value" text node text content: string(0) "" diff --git a/ext/dom/tests/modern/token_list/add_errors.phpt b/ext/dom/tests/modern/token_list/add_errors.phpt index 94db0d293114..070558edc4c8 100644 --- a/ext/dom/tests/modern/token_list/add_errors.phpt +++ b/ext/dom/tests/modern/token_list/add_errors.phpt @@ -10,32 +10,32 @@ $list = $dom->documentElement->classList; try { $list->add(""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->add(" "); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->add("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->add(0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(), "\n"; ?> --EXPECT-- -The empty string is not a valid token -The token must not contain any ASCII whitespace -Dom\TokenList::add(): Argument #1 must not contain any null bytes -Dom\TokenList::add(): Argument #1 must be of type string, int given +DOMException: The empty string is not a valid token +DOMException: The token must not contain any ASCII whitespace +ValueError: Dom\TokenList::add(): Argument #1 must not contain any null bytes +TypeError: Dom\TokenList::add(): Argument #1 must be of type string, int given diff --git a/ext/dom/tests/modern/token_list/contains_error.phpt b/ext/dom/tests/modern/token_list/contains_error.phpt index 9f402e685f4d..c2bc0865f7b4 100644 --- a/ext/dom/tests/modern/token_list/contains_error.phpt +++ b/ext/dom/tests/modern/token_list/contains_error.phpt @@ -11,10 +11,10 @@ $list = $element->classList; try { $list->contains("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Dom\TokenList::contains(): Argument #1 ($token) must not contain any null bytes +ValueError: Dom\TokenList::contains(): Argument #1 ($token) must not contain any null bytes diff --git a/ext/dom/tests/modern/token_list/dimensions.phpt b/ext/dom/tests/modern/token_list/dimensions.phpt index e1507d61b08a..e012dfca7aa8 100644 --- a/ext/dom/tests/modern/token_list/dimensions.phpt +++ b/ext/dom/tests/modern/token_list/dimensions.phpt @@ -19,8 +19,8 @@ var_dump($list["0"], isset($list["0"]), empty($list["0"])); echo "--- \"foo\" ---\n"; try { var_dump($list["foo"], isset($list["foo"]), empty($list["foo"])); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- 1.1 ---\n"; @@ -68,7 +68,7 @@ string(1) "A" bool(true) bool(false) --- "foo" --- -Cannot access offset of type string on Dom\TokenList +TypeError: Cannot access offset of type string on Dom\TokenList --- 1.1 --- Deprecated: Implicit conversion from float 1.1 to int loses precision in %s on line %d diff --git a/ext/dom/tests/modern/token_list/dimensions_error.phpt b/ext/dom/tests/modern/token_list/dimensions_error.phpt index c29fc058ef94..d727a3f434ed 100644 --- a/ext/dom/tests/modern/token_list/dimensions_error.phpt +++ b/ext/dom/tests/modern/token_list/dimensions_error.phpt @@ -17,41 +17,41 @@ $testOffsets = [ foreach ($testOffsets as $offset) { try { $list[$offset]; - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($list[$offset]); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { empty($list[$offset]); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } try { $list[][0] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Cannot access offset of type stdClass on Dom\TokenList -Cannot access offset of type stdClass in isset or empty -Cannot access offset of type stdClass in isset or empty -Cannot access offset of type array on Dom\TokenList -Cannot access offset of type array in isset or empty -Cannot access offset of type array in isset or empty +TypeError: Cannot access offset of type stdClass on Dom\TokenList +TypeError: Cannot access offset of type stdClass in isset or empty +TypeError: Cannot access offset of type stdClass in isset or empty +TypeError: Cannot access offset of type array on Dom\TokenList +TypeError: Cannot access offset of type array in isset or empty +TypeError: Cannot access offset of type array in isset or empty Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -Cannot append to Dom\TokenList +Error: Cannot append to Dom\TokenList diff --git a/ext/dom/tests/modern/token_list/foreach_by_ref.phpt b/ext/dom/tests/modern/token_list/foreach_by_ref.phpt index b13b4c51c7c0..6a1d9f58a5ca 100644 --- a/ext/dom/tests/modern/token_list/foreach_by_ref.phpt +++ b/ext/dom/tests/modern/token_list/foreach_by_ref.phpt @@ -10,10 +10,10 @@ $dom = DOM\XMLDocument::createFromString(''); try { foreach ($dom->documentElement->classList as &$class) { } -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -An iterator cannot be used with foreach by reference +Error: An iterator cannot be used with foreach by reference diff --git a/ext/dom/tests/modern/token_list/remove_errors.phpt b/ext/dom/tests/modern/token_list/remove_errors.phpt index fe0e58c334c9..e14bf249dd43 100644 --- a/ext/dom/tests/modern/token_list/remove_errors.phpt +++ b/ext/dom/tests/modern/token_list/remove_errors.phpt @@ -10,32 +10,32 @@ $list = $dom->documentElement->classList; try { $list->remove(""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->remove(" "); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->remove("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->remove(0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveXML(), "\n"; ?> --EXPECT-- -The empty string is not a valid token -The token must not contain any ASCII whitespace -Dom\TokenList::remove(): Argument #1 must not contain any null bytes -Dom\TokenList::remove(): Argument #1 must be of type string, int given +DOMException: The empty string is not a valid token +DOMException: The token must not contain any ASCII whitespace +ValueError: Dom\TokenList::remove(): Argument #1 must not contain any null bytes +TypeError: Dom\TokenList::remove(): Argument #1 must be of type string, int given diff --git a/ext/dom/tests/modern/token_list/replace_error.phpt b/ext/dom/tests/modern/token_list/replace_error.phpt index 14b02373d57d..21fce149b96d 100644 --- a/ext/dom/tests/modern/token_list/replace_error.phpt +++ b/ext/dom/tests/modern/token_list/replace_error.phpt @@ -11,24 +11,24 @@ $list = $element->classList; try { $list->replace("\0", "X"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->replace("X", "\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->replace("a b", "X"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Dom\TokenList::replace(): Argument #1 ($token) must not contain any null bytes -Dom\TokenList::replace(): Argument #2 ($newToken) must not contain any null bytes -The token must not contain any ASCII whitespace +ValueError: Dom\TokenList::replace(): Argument #1 ($token) must not contain any null bytes +ValueError: Dom\TokenList::replace(): Argument #2 ($newToken) must not contain any null bytes +DOMException: The token must not contain any ASCII whitespace diff --git a/ext/dom/tests/modern/token_list/supports.phpt b/ext/dom/tests/modern/token_list/supports.phpt index 6fc1d7f22549..3c42a1190be7 100644 --- a/ext/dom/tests/modern/token_list/supports.phpt +++ b/ext/dom/tests/modern/token_list/supports.phpt @@ -9,10 +9,10 @@ $dom = DOM\XMLDocument::createFromString(''); $element = $dom->documentElement; try { $element->classList->supports('a'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attribute "class" does not define any supported tokens +TypeError: Attribute "class" does not define any supported tokens diff --git a/ext/dom/tests/modern/token_list/toggle_error.phpt b/ext/dom/tests/modern/token_list/toggle_error.phpt index 7e3cfd462023..22ef1ed5eaef 100644 --- a/ext/dom/tests/modern/token_list/toggle_error.phpt +++ b/ext/dom/tests/modern/token_list/toggle_error.phpt @@ -11,17 +11,17 @@ $list = $element->classList; try { $list->toggle("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->toggle("a b"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Dom\TokenList::toggle(): Argument #1 ($token) must not contain any null bytes -The token must not contain any ASCII whitespace +ValueError: Dom\TokenList::toggle(): Argument #1 ($token) must not contain any null bytes +DOMException: The token must not contain any ASCII whitespace diff --git a/ext/dom/tests/modern/token_list/value_edge_cases.phpt b/ext/dom/tests/modern/token_list/value_edge_cases.phpt index af32d84180ba..ce030dad9f90 100644 --- a/ext/dom/tests/modern/token_list/value_edge_cases.phpt +++ b/ext/dom/tests/modern/token_list/value_edge_cases.phpt @@ -12,8 +12,8 @@ var_dump($list->value); try { $list->value = "\0"; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($list->value); @@ -21,5 +21,5 @@ var_dump($list->value); ?> --EXPECT-- string(0) "" -Value must not contain any null bytes +ValueError: Value must not contain any null bytes string(0) "" diff --git a/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt b/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt index cc2d7a06a2ca..6ac1de9e955e 100644 --- a/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt +++ b/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt @@ -23,8 +23,8 @@ $overflow = 4294967296; function dump_access(Closure $callback): void { try { var_dump($callback()?->nodeName); - } catch (ValueError $e) { - echo $e->getMessage(), PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -36,6 +36,6 @@ dump_access(fn() => $doc->doctype->notations[$overflow]); ?> --EXPECT-- NULL -must be between 0 and 2147483647 +ValueError: must be between 0 and 2147483647 NULL -must be between 0 and 2147483647 +ValueError: must be between 0 and 2147483647 diff --git a/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt b/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt index 0316ac88439f..53d61facc6bd 100644 --- a/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt @@ -18,8 +18,8 @@ function test($child, $html) { global $dom, $original; try { $child->innerHTML = $html; - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveXML() === $original); } @@ -33,15 +33,15 @@ test($child, ''); ?> --EXPECT-- -XML fragment is not well-formed +DOMException: XML fragment is not well-formed bool(true) -XML fragment is not well-formed +DOMException: XML fragment is not well-formed bool(true) -XML fragment is not well-formed +DOMException: XML fragment is not well-formed bool(true) -XML fragment is not well-formed +DOMException: XML fragment is not well-formed bool(true) -XML fragment is not well-formed +DOMException: XML fragment is not well-formed bool(true) -XML fragment is not well-formed +DOMException: XML fragment is not well-formed bool(true) diff --git a/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt b/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt index 585c9c5fd875..9e71a18caf09 100644 --- a/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt @@ -16,13 +16,13 @@ function createContainer() { function test($container) { try { var_dump($container->innerHTML); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($container->outerHTML); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -96,33 +96,33 @@ test($container); ?> --EXPECT-- -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed -The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed diff --git a/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt b/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt index 0ecd1d487360..2f056375b51a 100644 --- a/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt @@ -8,10 +8,10 @@ dom $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->insertAdjacentHTML(Dom\AdjacentPosition::AfterBegin, ""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -XML fragment is not well-formed +DOMException: XML fragment is not well-formed diff --git a/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt b/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt index f7602539acac..bdcbfafccedd 100644 --- a/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt @@ -8,18 +8,18 @@ dom $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->outerHTML = ''; -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->firstChild->outerHTML = ''; -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Invalid Modification Error -XML fragment is not well-formed +DOMException: Invalid Modification Error +DOMException: XML fragment is not well-formed diff --git a/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt b/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt index eae3c97dbf00..37ec160ce0d8 100644 --- a/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt +++ b/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt @@ -11,10 +11,10 @@ $child = $comment->nextSibling; try { $comment->removeChild($child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Not Found Error +DOMException: Not Found Error diff --git a/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt b/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt index f48c5f7f5a14..74b6da076376 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt @@ -7,8 +7,8 @@ dom try { Dom\XMLDocument::createFromFile(__DIR__ . '/dummy.xml', overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // The override encoding matches with the document encoding attribute @@ -23,7 +23,7 @@ var_dump($dom->charset); ?> --EXPECT-- -Dom\XMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding +ValueError: Dom\XMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding string(2) "é" string(5) "UTF-8" string(4) "é" diff --git a/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt b/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt index e45f74847dd1..add2a8cdd08b 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt @@ -7,8 +7,8 @@ dom try { Dom\XMLDocument::createFromString(file_get_contents(__DIR__ . '/dummy.xml'), overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // The override encoding matches with the document encoding attribute @@ -23,7 +23,7 @@ var_dump($dom->charset); ?> --EXPECT-- -Dom\XMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding +ValueError: Dom\XMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding string(2) "é" string(5) "UTF-8" string(4) "é" diff --git a/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt b/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt index 73c1b0d22356..8ced79db210c 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt @@ -7,10 +7,10 @@ dom try { Dom\XMLDocument::createFromFile("%00"); -} catch (ValueError $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Dom\XMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes +ValueError: Dom\XMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes diff --git a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt index 16db09547bff..d56b6ad46858 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt @@ -11,8 +11,8 @@ $flags = [ try { Dom\XMLDocument::createFromString('', -1); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } foreach ($flags as $flag) { @@ -21,7 +21,7 @@ foreach ($flags as $flag) { ?> --EXPECTF-- -Dom\XMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: %s) +ValueError: Dom\XMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: %s) bool(true) bool(true) bool(true) diff --git a/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt b/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt index b42c21ed9ab1..bd8b15196837 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt @@ -45,8 +45,8 @@ echo "--- Get a namespace node ---\n"; // Namespace nodes don't exist in modern day DOM. try { var_dump($xpath->evaluate("//*/namespace::*")); -} catch (DOMException $e) { - echo $e->getCode(), ": ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n"; } ?> @@ -71,4 +71,4 @@ string(4) "data" string(11) "Dom\Comment" string(9) " comment " --- Get a namespace node --- -9: The namespace axis is not well-defined in the living DOM specification. Use Dom\Element::getInScopeNamespaces() or Dom\Element::getDescendantNamespaces() instead. +DOMException: 9: The namespace axis is not well-defined in the living DOM specification. Use Dom\Element::getInScopeNamespaces() or Dom\Element::getDescendantNamespaces() instead. diff --git a/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt b/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt index 1ef52b50961f..4d0a908c8fcc 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt @@ -11,11 +11,11 @@ $xpath = new Dom\XPath($dom); try { var_dump($xpath->evaluate('-')); -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Dom\XPath::evaluate(): Invalid expression in %s on line %d -string(35) "Could not evaluate XPath expression" +Error: Could not evaluate XPath expression diff --git a/ext/dom/tests/modern/xml/canonicalize_unattached.phpt b/ext/dom/tests/modern/xml/canonicalize_unattached.phpt index cec5f1085757..e5d4bb7e9d04 100644 --- a/ext/dom/tests/modern/xml/canonicalize_unattached.phpt +++ b/ext/dom/tests/modern/xml/canonicalize_unattached.phpt @@ -11,10 +11,10 @@ $child->remove(); try { $child->C14N(); -} catch (Dom\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Canonicalization can only happen on nodes attached to a document. +DOMException: Canonicalization can only happen on nodes attached to a document. diff --git a/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt b/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt index 7770143b2248..9de8f4007d4f 100644 --- a/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt +++ b/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt @@ -15,11 +15,11 @@ $x = $dom->documentElement->firstChild; $x->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:a', ''); try { var_dump($dom->documentElement->innerHTML); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(13) "" -The resulting XML serialization is not well-formed +DOMException: The resulting XML serialization is not well-formed diff --git a/ext/dom/tests/modern/xml/simplexml_interop.phpt b/ext/dom/tests/modern/xml/simplexml_interop.phpt index a1b02b7bdd83..52c2b61ae459 100644 --- a/ext/dom/tests/modern/xml/simplexml_interop.phpt +++ b/ext/dom/tests/modern/xml/simplexml_interop.phpt @@ -21,8 +21,8 @@ echo $element->ownerDocument->saveXml($element), "\n"; // This should fail because it has been imported already above in modern DOM try { dom_import_simplexml($sxe); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // Import again and compare @@ -37,5 +37,5 @@ object(Dom\NamedNodeMap)#3 (1) { foo foo foovalue -dom_import_simplexml(): Argument #1 ($node) must not be already imported as a Dom\Node +TypeError: dom_import_simplexml(): Argument #1 ($node) must not be already imported as a Dom\Node bool(true) diff --git a/ext/dom/tests/not_serializable.phpt b/ext/dom/tests/not_serializable.phpt index 36053070f400..82bf2d4ad53e 100644 --- a/ext/dom/tests/not_serializable.phpt +++ b/ext/dom/tests/not_serializable.phpt @@ -9,49 +9,49 @@ $doc = new DOMDocument(); $doc->loadXML(''); try { serialize($doc); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $node = $doc->documentElement; try { serialize($node); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $xpath = new DOMXPath($doc); try { serialize($xpath); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ns = $xpath->query('//namespace::*')->item(0); try { serialize($ns); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createEmpty(); try { serialize($dom); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { serialize(new Dom\XPath($dom)); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Serialization of 'DOMDocument' is not allowed, unless serialization methods are implemented in a subclass -Serialization of 'DOMElement' is not allowed, unless serialization methods are implemented in a subclass -Serialization of 'DOMXPath' is not allowed -Serialization of 'DOMNameSpaceNode' is not allowed, unless serialization methods are implemented in a subclass -Serialization of 'Dom\XMLDocument' is not allowed, unless serialization methods are implemented in a subclass -Serialization of 'Dom\XPath' is not allowed +Exception: Serialization of 'DOMDocument' is not allowed, unless serialization methods are implemented in a subclass +Exception: Serialization of 'DOMElement' is not allowed, unless serialization methods are implemented in a subclass +Exception: Serialization of 'DOMXPath' is not allowed +Exception: Serialization of 'DOMNameSpaceNode' is not allowed, unless serialization methods are implemented in a subclass +Exception: Serialization of 'Dom\XMLDocument' is not allowed, unless serialization methods are implemented in a subclass +Exception: Serialization of 'Dom\XPath' is not allowed diff --git a/ext/dom/tests/not_unserializable.phpt b/ext/dom/tests/not_unserializable.phpt index a25a2737e852..8b3d2ce695c6 100644 --- a/ext/dom/tests/not_unserializable.phpt +++ b/ext/dom/tests/not_unserializable.phpt @@ -16,14 +16,14 @@ foreach ($classes as $class) { try { unserialize('O:' . strlen($class) . ':"' . $class . '":0:{}'); - } catch (Exception $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Unserialization of 'DOMXPath' is not allowed -Unserialization of 'DOMDocument' is not allowed, unless unserialization methods are implemented in a subclass -Unserialization of 'DOMNode' is not allowed, unless unserialization methods are implemented in a subclass -Unserialization of 'DOMNameSpaceNode' is not allowed, unless unserialization methods are implemented in a subclass +Exception: Unserialization of 'DOMXPath' is not allowed +Exception: Unserialization of 'DOMDocument' is not allowed, unless unserialization methods are implemented in a subclass +Exception: Unserialization of 'DOMNode' is not allowed, unless unserialization methods are implemented in a subclass +Exception: Unserialization of 'DOMNameSpaceNode' is not allowed, unless unserialization methods are implemented in a subclass diff --git a/ext/dom/tests/null_text_content_manipulation.phpt b/ext/dom/tests/null_text_content_manipulation.phpt index 9b1e35d60f76..12e18ac74063 100644 --- a/ext/dom/tests/null_text_content_manipulation.phpt +++ b/ext/dom/tests/null_text_content_manipulation.phpt @@ -7,27 +7,27 @@ dom $text = new DOMText(); try { var_dump($text->substringData(1, 0)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->insertData(1, "")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->deleteData(1, 1)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->replaceData(1, 1, "")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Index Size Error -Index Size Error -Index Size Error -Index Size Error +DOMException: Index Size Error +DOMException: Index Size Error +DOMException: Index Size Error +DOMException: Index Size Error diff --git a/ext/dom/tests/php_function_edge_cases.phpt b/ext/dom/tests/php_function_edge_cases.phpt index 1091b50ce19b..9be75918ec35 100644 --- a/ext/dom/tests/php_function_edge_cases.phpt +++ b/ext/dom/tests/php_function_edge_cases.phpt @@ -12,16 +12,16 @@ $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPHPFunctions(); try { $xpath->query("//a[php:function(3)]"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->query("//a[php:function()]"); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Handler name must be a string -Function name must be passed as the first argument +TypeError: Handler name must be a string +Error: Function name must be passed as the first argument diff --git a/ext/dom/tests/property_write_errors.phpt b/ext/dom/tests/property_write_errors.phpt index 7d2af3b10555..0459f10b8fea 100644 --- a/ext/dom/tests/property_write_errors.phpt +++ b/ext/dom/tests/property_write_errors.phpt @@ -10,47 +10,47 @@ $dom = new DOMDocument(); try { $dom->nodeValue = []; -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $dom->nodeType += 1; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $dom->xmlEncoding = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $entity = new DOMEntity(); try { $entity->actualEncoding = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $entity->encoding = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $entity->version = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign array to property DOMNode::$nodeValue of type ?string -Cannot modify private(set) property DOMNode::$nodeType from global scope -Cannot modify private(set) property DOMDocument::$xmlEncoding from global scope -Cannot modify private(set) property DOMEntity::$actualEncoding from global scope -Cannot modify private(set) property DOMEntity::$encoding from global scope -Cannot modify private(set) property DOMEntity::$version from global scope +TypeError: Cannot assign array to property DOMNode::$nodeValue of type ?string +Error: Cannot modify private(set) property DOMNode::$nodeType from global scope +Error: Cannot modify private(set) property DOMDocument::$xmlEncoding from global scope +Error: Cannot modify private(set) property DOMEntity::$actualEncoding from global scope +Error: Cannot modify private(set) property DOMEntity::$encoding from global scope +Error: Cannot modify private(set) property DOMEntity::$version from global scope diff --git a/ext/dom/tests/registerNodeClass_abstract_class.phpt b/ext/dom/tests/registerNodeClass_abstract_class.phpt index 24124d712ea0..e83643702c33 100644 --- a/ext/dom/tests/registerNodeClass_abstract_class.phpt +++ b/ext/dom/tests/registerNodeClass_abstract_class.phpt @@ -13,8 +13,8 @@ $dom = new DOMDocument; try { $dom->registerNodeClass("DOMElement", "Test"); -} catch (ValueError $e) { - echo "ValueError: ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom->createElement("foo"); diff --git a/ext/dom/tests/registerPhpFunctionNS_errors.phpt b/ext/dom/tests/registerPhpFunctionNS_errors.phpt index 5098d8f7a84f..e366b58d3dd7 100644 --- a/ext/dom/tests/registerPhpFunctionNS_errors.phpt +++ b/ext/dom/tests/registerPhpFunctionNS_errors.phpt @@ -17,45 +17,45 @@ $xpath = new DOMXPath($doc); try { $xpath->registerPhpFunctionNS('http://php.net/xpath', 'strtolower', strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS('http://php.net/xpath', 'test', [new TrampolineClass, 'test']); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS('urn:foo', '$$$', [new TrampolineClass, 'test']); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS('urn:foo', 'x:a', strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS("urn:foo", "\0", strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS("\0", 'strtolower', strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP -DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP -DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name -DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name -DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must not contain any null bytes -DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not contain any null bytes +ValueError: DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP +ValueError: DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP +ValueError: DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name +ValueError: DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name +ValueError: DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must not contain any null bytes +ValueError: DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not contain any null bytes diff --git a/ext/dom/tests/register_node_class.phpt b/ext/dom/tests/register_node_class.phpt index 7482ec27bfa0..0ceddc6b4931 100644 --- a/ext/dom/tests/register_node_class.phpt +++ b/ext/dom/tests/register_node_class.phpt @@ -29,8 +29,8 @@ $attr = $root->getAttributeNode('a'); echo get_class($attr), "\n"; try { print $attr->testit()."\n"; -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -39,4 +39,4 @@ HELLO Element myAttribute HELLO Attribute DOMAttr -Call to undefined method DOMAttr::testit() +Error: Call to undefined method DOMAttr::testit() diff --git a/ext/dom/tests/replaceChild_attribute_validation.phpt b/ext/dom/tests/replaceChild_attribute_validation.phpt index 32d5990f75e3..420b06b78598 100644 --- a/ext/dom/tests/replaceChild_attribute_validation.phpt +++ b/ext/dom/tests/replaceChild_attribute_validation.phpt @@ -11,8 +11,8 @@ $attr->textContent = "test"; try { $attr->replaceChild($dom->createProcessingInstruction('pi'), $attr->firstChild); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $root = $dom->appendChild($dom->createElement('root')); @@ -22,6 +22,6 @@ echo $dom->saveXML(); ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/unsetting_properties.phpt b/ext/dom/tests/unsetting_properties.phpt index ec309c18bf58..69fe50112bc3 100644 --- a/ext/dom/tests/unsetting_properties.phpt +++ b/ext/dom/tests/unsetting_properties.phpt @@ -17,16 +17,16 @@ $root = $dom->documentElement; unset($root->myProp); try { $root->myProp; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($root->textContent); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Typed property MyElement::$myProp must not be accessed before initialization -Cannot unset MyElement::$textContent +Error: Typed property MyElement::$myProp must not be accessed before initialization +Error: Cannot unset MyElement::$textContent diff --git a/ext/dom/tests/xpath_domnamespacenode_advanced.phpt b/ext/dom/tests/xpath_domnamespacenode_advanced.phpt index bbc49dc54652..21ba3ab8df6d 100644 --- a/ext/dom/tests/xpath_domnamespacenode_advanced.phpt +++ b/ext/dom/tests/xpath_domnamespacenode_advanced.phpt @@ -29,8 +29,8 @@ foreach ($xpath->query($query) as $attribute) { // Second & third attempt should fail because it's no longer in the document try { $attribute->parentNode->remove(); - } catch (\DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // However, it should not cause a use-after-free echo "After: ", $attribute->parentNode->tagName, "\n"; @@ -57,19 +57,19 @@ string(5) "child" Before: root After: root Before: root -Not Found Error +DOMException: Not Found Error After: root Before: root -Not Found Error +DOMException: Not Found Error After: root Before: child After: child Before: child -Not Found Error +DOMException: Not Found Error After: child Before: child -Not Found Error +DOMException: Not Found Error After: child Before: child -Not Found Error +DOMException: Not Found Error After: child From da78fab1ffe002c06e176e75b912dc23038ff347 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:26:41 +0700 Subject: [PATCH 20/27] Zend: applied fixers to improve test robustness (part 7/8) (#23315) --- Zend/tests/type_declarations/scalar_none.phpt | 10 +- Zend/tests/type_declarations/scalar_null.phpt | 12 +- .../scalar_return_basic_64bit.phpt | 56 ++++----- .../scalar_strict_64bit.phpt | 106 +++++++++--------- .../scalar_strict_basic.phpt | 64 +++++------ .../type_declarations/static_type_return.phpt | 18 +-- .../typed_class_constants_ast_print.phpt | 6 +- .../typed_class_constants_diamond_error1.phpt | 6 +- ..._class_constants_inheritance_success2.phpt | 2 +- .../typed_class_constants_type_error11.phpt | 6 +- .../typed_class_constants_type_error2.phpt | 12 +- .../typed_class_constants_type_error3.phpt | 12 +- .../typed_class_constants_type_error7.phpt | 12 +- .../typed_class_constants_type_error8.phpt | 24 ++-- .../typed_class_constants_type_error9.phpt | 6 +- .../typed_properties_019.phpt | 6 +- .../typed_properties_020.phpt | 6 +- .../typed_properties_021.phpt | 6 +- .../typed_properties_033.phpt | 4 +- .../typed_properties_034.phpt | 8 +- .../typed_properties_038.phpt | 24 ++-- .../typed_properties_043.phpt | 18 +-- .../typed_properties_044.phpt | 16 +-- .../typed_properties_045.phpt | 14 +-- .../typed_properties_046.phpt | 12 +- .../typed_properties_047.phpt | 8 +- .../typed_properties_051.phpt | 4 +- .../typed_properties_056.phpt | 4 +- .../typed_properties_057.phpt | 8 +- .../typed_properties_058.phpt | 6 +- .../typed_properties_062.phpt | 24 ++-- .../typed_properties_063.phpt | 24 ++-- .../typed_properties_064.phpt | 24 ++-- .../typed_properties_065.phpt | 16 +-- .../typed_properties_068.phpt | 20 ++-- .../typed_properties_069.phpt | 8 +- .../typed_properties_070.phpt | 8 +- .../typed_properties_074.phpt | 4 +- .../typed_properties_075.phpt | 24 ++-- .../typed_properties_076.phpt | 8 +- .../typed_properties_078.phpt | 12 +- .../typed_properties_079.phpt | 8 +- .../typed_properties_080.phpt | 18 +-- .../typed_properties_081.phpt | 4 +- .../typed_properties_082.phpt | 4 +- .../typed_properties_083.phpt | 28 ++--- .../typed_properties_093.phpt | 6 +- .../typed_properties_095.phpt | 30 ++--- .../typed_properties_096.phpt | 6 +- .../typed_properties_097.phpt | 50 ++++----- .../typed_properties_102.phpt | 6 +- .../typed_properties_105.phpt | 1 - .../typed_properties_106.phpt | 12 +- .../typed_properties_110.phpt | 6 +- .../typed_properties_111.phpt | 6 +- .../typed_properties_112.phpt | 6 +- .../typed_properties_114.phpt | 8 +- .../typed_properties_115.phpt | 4 +- .../typed_properties_cache_slot_opt.phpt | 8 +- .../typed_properties_class_loading.phpt | 12 +- ..._properties_failed_assign_is_not_init.phpt | 18 +-- .../typed_properties_magic_set.phpt | 6 +- .../union_types/anonymous_class.phpt | 8 +- .../union_types/incdec_prop.phpt | 48 ++++---- .../union_types/inheritance_internal.phpt | 12 +- .../union_types/multiple_classes.phpt | 12 +- .../union_types/prop_ref_assign.phpt | 24 ++-- .../variance/loading_exception1.phpt | 12 +- .../variance/loading_exception2.phpt | 12 +- .../variance/unlinked_parent_1.phpt | 6 +- .../variance/unlinked_parent_2.phpt | 6 +- Zend/tests/undef_index_to_exception.phpt | 24 ++-- .../undefined_multidimensional_array.phpt | 12 +- .../unpack_iterator_by_ref_type_check.phpt | 6 +- Zend/tests/unset/unset_non_array.phpt | 60 +++++----- .../varSyntax/constant_object_deref.phpt | 12 +- .../varSyntax/encapsed_string_deref.phpt | 6 +- Zend/tests/varSyntax/magic_const_deref.phpt | 6 +- .../variadic/typehint_suppressed_error.phpt | 6 +- .../weakrefs/weakmap_basic_map_behavior.phpt | 6 +- .../weakrefs/weakmap_error_conditions.phpt | 72 ++++++------ Zend/tests/weakrefs/weakrefs_002.phpt | 12 +- Zend/tests/weakrefs/weakrefs_003.phpt | 12 +- Zend/tests/weakrefs/weakrefs_006.phpt | 2 +- Zend/tests/xor_001.phpt | 6 +- Zend/tests/zpp/iterable_or_null.phpt | 25 ++--- 86 files changed, 660 insertions(+), 662 deletions(-) diff --git a/Zend/tests/type_declarations/scalar_none.phpt b/Zend/tests/type_declarations/scalar_none.phpt index 8316b51fa9ef..764f6a8a5745 100644 --- a/Zend/tests/type_declarations/scalar_none.phpt +++ b/Zend/tests/type_declarations/scalar_none.phpt @@ -19,20 +19,20 @@ foreach ($functions as $type => $function) { try { var_dump($function()); } catch (Throwable $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), "\n"; } } echo PHP_EOL . "Done"; ?> --EXPECTF-- Testing int: -*** Caught 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 Testing float: -*** Caught 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 Testing string: -*** Caught 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 Testing bool: -*** Caught 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 Testing int nullable: NULL Testing float nullable: diff --git a/Zend/tests/type_declarations/scalar_null.phpt b/Zend/tests/type_declarations/scalar_null.phpt index f69aec3b5b6e..fb7c52ba2fa0 100644 --- a/Zend/tests/type_declarations/scalar_null.phpt +++ b/Zend/tests/type_declarations/scalar_null.phpt @@ -18,8 +18,8 @@ foreach ($functions as $type => $function) { echo "Testing $type:", PHP_EOL; try { var_dump($function(null)); - } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -27,13 +27,13 @@ echo PHP_EOL . "Done"; ?> --EXPECTF-- Testing int: -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d Testing float: -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d Testing string: -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d Testing bool: -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d Testing int nullable: NULL Testing float nullable: diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt index 498092e8ac54..e3cf8927662a 100644 --- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt @@ -54,8 +54,8 @@ foreach ($functions as $type => $function) { var_dump($value); try { var_dump($function($value)); - } catch (TypeError $e) { - echo "*** Caught ", $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(), PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), ' on line ', $e->getLine(), "\n"; } } } @@ -74,32 +74,32 @@ int(1) E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line %d int(1) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d *** Trying int(9223372036854775807) int(9223372036854775807) *** Trying float(NAN) -*** Caught {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d *** Trying bool(true) int(1) *** Trying bool(false) int(0) *** Trying NULL -*** Caught {closure:%s:%d}(): Return value must be of type int, null returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d Testing 'float' type: *** Trying int(1) @@ -111,11 +111,11 @@ float(1) *** Trying float(1.5) float(1.5) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d *** Trying int(9223372036854775807) float(9.223372036854776E+18) *** Trying float(NAN) @@ -125,18 +125,18 @@ float(1) *** Trying bool(false) float(0) *** Trying NULL -*** Caught {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d Testing 'string' type: *** Trying int(1) @@ -163,18 +163,18 @@ string(1) "1" *** Trying bool(false) string(0) "" *** Trying NULL -*** Caught {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d *** Trying object(StringCapable)#%d (0) { } string(6) "foobar" *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d Testing 'bool' type: *** Trying int(1) @@ -201,17 +201,17 @@ bool(true) *** Trying bool(false) bool(false) *** Trying NULL -*** Caught {closure:%s:%d}(): Return value must be of type bool, null returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type bool, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d +TypeError: {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_strict_64bit.phpt b/Zend/tests/type_declarations/scalar_strict_64bit.phpt index b7f2ce0de439..fe3012b83c0b 100644 --- a/Zend/tests/type_declarations/scalar_strict_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_strict_64bit.phpt @@ -45,8 +45,8 @@ foreach ($functions as $type => $function) { var_dump($value); try { var_dump($function($value)); - } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -60,52 +60,52 @@ Testing 'int' type: int(1) *** Trying string(1) "1" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying float(1) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying float(1.5) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying int(9223372036854775807) int(9223372036854775807) *** Trying float(NAN) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d *** Trying bool(false) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -113,7 +113,7 @@ Testing 'float' type: float(1) *** Trying string(1) "1" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying float(1) float(1) @@ -122,13 +122,13 @@ float(1) float(1.5) *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying int(9223372036854775807) float(9.223372036854776E+18) @@ -137,42 +137,42 @@ float(9.223372036854776E+18) float(NAN) *** Trying bool(true) -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d *** Trying bool(false) -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: *** Trying int(1) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d *** Trying string(1) "1" string(1) "1" *** Trying float(1) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying float(1.5) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying string(2) "1a" string(2) "1a" @@ -184,63 +184,63 @@ string(1) "a" string(0) "" *** Trying int(9223372036854775807) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d *** Trying float(NAN) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying bool(true) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d *** Trying bool(false) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: *** Trying int(1) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d *** Trying string(1) "1" -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying float(1) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying float(1.5) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying string(2) "1a" -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying int(9223372036854775807) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d *** Trying float(NAN) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying bool(true) bool(true) @@ -249,21 +249,21 @@ bool(true) bool(false) *** Trying NULL -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object(stdClass)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%d (0) { } -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_strict_basic.phpt b/Zend/tests/type_declarations/scalar_strict_basic.phpt index 462bed7983d6..2cc3430e9126 100644 --- a/Zend/tests/type_declarations/scalar_strict_basic.phpt +++ b/Zend/tests/type_declarations/scalar_strict_basic.phpt @@ -43,8 +43,8 @@ foreach ($functions as $type => $function) { echo PHP_EOL . "*** Trying ", type($value), " value", PHP_EOL; try { var_dump($function($value)); - } catch (TypeError $e) { - echo "*** Caught " . $e->getMessage() . PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -57,28 +57,28 @@ Testing 'int' type: int(1) *** Trying float value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying string value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying true value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d *** Trying false value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d *** Trying null value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -89,65 +89,65 @@ float(1) float(1) *** Trying string value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying true value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d *** Trying false value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d *** Trying null value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: *** Trying integer value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d *** Trying float value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying string value string(1) "1" *** Trying true value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d *** Trying false value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d *** Trying null value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: *** Trying integer value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d *** Trying float value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying string value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying true value bool(true) @@ -156,15 +156,15 @@ bool(true) bool(false) *** Trying null value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/static_type_return.phpt b/Zend/tests/type_declarations/static_type_return.phpt index 0d37a8004650..069916cf0154 100644 --- a/Zend/tests/type_declarations/static_type_return.phpt +++ b/Zend/tests/type_declarations/static_type_return.phpt @@ -36,8 +36,8 @@ echo "\n"; var_dump($a->test2()); try { var_dump($b->test2()); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -48,8 +48,8 @@ echo "\n"; var_dump($a->test4()); try { var_dump($b->test4()); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n"; @@ -59,8 +59,8 @@ $test = function($x): static { try { var_dump($test(new stdClass)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $test = $test->bindTo($a); @@ -75,7 +75,7 @@ object(B)#%d (0) { object(A)#%d (0) { } -A::test2(): Return value must be of type B, A returned +TypeError: A::test2(): Return value must be of type B, A returned object(A)#%d (0) { } @@ -84,8 +84,8 @@ object(C)#%d (0) { object(A)#%d (0) { } -A::test4(): Return value must be of type B|array, A returned +TypeError: A::test4(): Return value must be of type B|array, A returned -{closure:%s:%d}(): Return value must be of type static, stdClass returned +TypeError: {closure:%s:%d}(): Return value must be of type static, stdClass returned object(A)#%d (0) { } diff --git a/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt b/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt index dd4957f2269c..b62b7263c8a2 100644 --- a/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt @@ -7,12 +7,12 @@ try { assert(false && new class { public const int X = 1; }); -} catch (AssertionError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -assert(false && new class { +AssertionError: assert(false && new class { public const int X = 1; }) diff --git a/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt b/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt index 059c3cb2005b..432061f008ad 100644 --- a/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt @@ -8,9 +8,9 @@ class A { try { define("C", new A()); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "C" +Error: Undefined constant "C" diff --git a/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt b/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt index 40e079c3596e..9091bb80f9fa 100644 --- a/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt @@ -45,4 +45,4 @@ object(Z)#%d (%d) { object(Z)#%d (%d) { } object(Z)#%d (%d) { -} \ No newline at end of file +} diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt index 714e5a00995c..87c08de2cb63 100644 --- a/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt @@ -12,10 +12,10 @@ enum E2 { try { var_dump(E1::C); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign E2 to class constant E1::C of type static +TypeError: Cannot assign E2 to class constant E1::C of type static diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt index 8acffaa38399..b23d78a55e69 100644 --- a/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt @@ -10,17 +10,17 @@ define("C", "c"); try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign string to class constant A::CONST1 of type int -Cannot assign string to class constant A::CONST1 of type int +TypeError: Cannot assign string to class constant A::CONST1 of type int +TypeError: Cannot assign string to class constant A::CONST1 of type int diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt index 1e6ab277dec8..bc98e08d6e97 100644 --- a/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt @@ -10,16 +10,16 @@ define('C', new stdClass); try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign stdClass to class constant A::CONST1 of type string -Cannot assign stdClass to class constant A::CONST1 of type string +TypeError: Cannot assign stdClass to class constant A::CONST1 of type string +TypeError: Cannot assign stdClass to class constant A::CONST1 of type string diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt index 6fce75016630..06bbd27e5d3f 100644 --- a/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt @@ -10,16 +10,16 @@ define("C", new stdClass); try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable -Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable +TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable +TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt index cbd3720a5ea4..ecc82482c883 100644 --- a/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt @@ -11,30 +11,30 @@ define("C", new stdClass); try { var_dump(A::CONST2); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(A::CONST2); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(A::CONST1); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable -Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable -Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable -Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable +TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable +TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable +TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable +TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt index b0f42b2078a5..7094d7bf2425 100644 --- a/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt +++ b/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt @@ -17,9 +17,9 @@ define("S", new S()); try { var_dump(A::S); -} catch (TypeError $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign S to class constant A::S of type string +TypeError: Cannot assign S to class constant A::S of type string diff --git a/Zend/tests/type_declarations/typed_properties_019.phpt b/Zend/tests/type_declarations/typed_properties_019.phpt index d804b9c799d1..244fe0dd1e73 100644 --- a/Zend/tests/type_declarations/typed_properties_019.phpt +++ b/Zend/tests/type_declarations/typed_properties_019.phpt @@ -14,9 +14,9 @@ $foo = new Foo(); try { $foo->inc(); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot increment property Foo::$bar of type int past its maximal value +TypeError: Cannot increment property Foo::$bar of type int past its maximal value diff --git a/Zend/tests/type_declarations/typed_properties_020.phpt b/Zend/tests/type_declarations/typed_properties_020.phpt index 3b16a9d81d0e..92b4e86ad637 100644 --- a/Zend/tests/type_declarations/typed_properties_020.phpt +++ b/Zend/tests/type_declarations/typed_properties_020.phpt @@ -11,8 +11,8 @@ class Foo { $this->bar += 2; try { $this->bar += 1.5; - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -22,5 +22,5 @@ $foo = new Foo(); var_dump($foo->bar); ?> --EXPECT-- -Cannot assign float to property Foo::$bar of type int +TypeError: Cannot assign float to property Foo::$bar of type int int(2) diff --git a/Zend/tests/type_declarations/typed_properties_021.phpt b/Zend/tests/type_declarations/typed_properties_021.phpt index d4d4d0ed19d2..1c21bf6a90c6 100644 --- a/Zend/tests/type_declarations/typed_properties_021.phpt +++ b/Zend/tests/type_declarations/typed_properties_021.phpt @@ -8,9 +8,9 @@ class Foo { try { $foo = new Foo(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Class "BAR" not found +Error: Class "BAR" not found diff --git a/Zend/tests/type_declarations/typed_properties_033.phpt b/Zend/tests/type_declarations/typed_properties_033.phpt index 665026f07565..76d57e4ec48f 100644 --- a/Zend/tests/type_declarations/typed_properties_033.phpt +++ b/Zend/tests/type_declarations/typed_properties_033.phpt @@ -20,12 +20,12 @@ try { foreach ($foo->fetch() as &$prop) { $prop += 1; } -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); ?> --EXPECTF-- -Cannot assign float to reference held by property class@anonymous::$qux of type int +TypeError: Cannot assign float to reference held by property class@anonymous::$qux of type int object(class@anonymous)#1 (4) { ["foo"]=> int(2) diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt index 4af6baa80aef..dcda621774a7 100644 --- a/Zend/tests/type_declarations/typed_properties_034.phpt +++ b/Zend/tests/type_declarations/typed_properties_034.phpt @@ -22,7 +22,7 @@ foo($foo->bar); try { $foo->baz = &$foo->bar; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } $foo->bar = 10; foreach ($foo->getIterator() as &$item) { @@ -32,17 +32,17 @@ foreach ($foo->getIterator() as &$item) { try { foo($foo->bar); -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($foo); ?> --EXPECT-- int(42) -Cannot assign null to property class@anonymous::$baz of type int +TypeError: Cannot assign null to property class@anonymous::$baz of type int int(1) int(10) int(10) -Cannot assign null to reference held by property class@anonymous::$baz of type int +TypeError: Cannot assign null to reference held by property class@anonymous::$baz of type int object(class@anonymous)#1 (2) { ["bar"]=> &int(10) diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt index 4bb5b75a28fe..e9843aea3594 100644 --- a/Zend/tests/type_declarations/typed_properties_038.phpt +++ b/Zend/tests/type_declarations/typed_properties_038.phpt @@ -9,53 +9,53 @@ $foo = new class { try { $foo->bar++; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump($foo); try { $foo->bar += 1; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump($foo); try { ++$foo->bar; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump($foo); try { $foo->bar = $foo->bar + 1; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump($foo); ?> --EXPECTF-- -string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" +TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -string(65) "Cannot assign float to property class@anonymous::$bar of type int" +TypeError: Cannot assign float to property class@anonymous::$bar of type int object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" +TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -string(65) "Cannot assign float to property class@anonymous::$bar of type int" +TypeError: Cannot assign float to property class@anonymous::$bar of type int object(class@anonymous)#1 (1) { ["bar"]=> int(%d) diff --git a/Zend/tests/type_declarations/typed_properties_043.phpt b/Zend/tests/type_declarations/typed_properties_043.phpt index ed4951f39c37..c689c09e88fc 100644 --- a/Zend/tests/type_declarations/typed_properties_043.phpt +++ b/Zend/tests/type_declarations/typed_properties_043.phpt @@ -11,18 +11,18 @@ trait Test { try { Test::$selfProp = new stdClass; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Test::$selfNullProp = new stdClass; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Test::$parentProp = new stdClass; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } Test::$selfNullProp = null; @@ -42,13 +42,13 @@ var_dump(Bar::$selfProp, Bar::$selfNullProp, Bar::$parentProp); ?> --EXPECTF-- Deprecated: Accessing static trait property Test::$selfProp is deprecated, it should only be accessed on a class using the trait in %s on line %d -Cannot assign stdClass to property Test::$selfProp of type self +TypeError: Cannot assign stdClass to property Test::$selfProp of type self Deprecated: Accessing static trait property Test::$selfNullProp is deprecated, it should only be accessed on a class using the trait in %s on line %d -Cannot assign stdClass to property Test::$selfNullProp of type ?self +TypeError: Cannot assign stdClass to property Test::$selfNullProp of type ?self Deprecated: Accessing static trait property Test::$parentProp is deprecated, it should only be accessed on a class using the trait in %s on line %d -Cannot assign stdClass to property Test::$parentProp of type parent +TypeError: Cannot assign stdClass to property Test::$parentProp of type parent Deprecated: Accessing static trait property Test::$selfNullProp is deprecated, it should only be accessed on a class using the trait in %s on line %d diff --git a/Zend/tests/type_declarations/typed_properties_044.phpt b/Zend/tests/type_declarations/typed_properties_044.phpt index f32cd928444e..9933c15203a4 100644 --- a/Zend/tests/type_declarations/typed_properties_044.phpt +++ b/Zend/tests/type_declarations/typed_properties_044.phpt @@ -22,13 +22,13 @@ $bar = PHP_INT_MAX; try { var_dump($bar++); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(++$bar); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $bar = PHP_INT_MIN; @@ -37,13 +37,13 @@ $bar = PHP_INT_MIN; try { var_dump($bar--); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(--$bar); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -52,7 +52,7 @@ int(0) int(-2) int(-1) int(-1) -Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value -Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value -Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value -Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value +TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value +TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value diff --git a/Zend/tests/type_declarations/typed_properties_045.phpt b/Zend/tests/type_declarations/typed_properties_045.phpt index 7e4dc8e43fef..07ae8012a257 100644 --- a/Zend/tests/type_declarations/typed_properties_045.phpt +++ b/Zend/tests/type_declarations/typed_properties_045.phpt @@ -15,8 +15,8 @@ class Foo { var_dump($val); try { $val = []; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -33,8 +33,8 @@ foreach ($foo as $k => &$val) { try { $val = []; var_dump($foo->$k); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } $foo->test(); @@ -42,10 +42,10 @@ $foo->test(); --EXPECT-- int(0) int(20) -Cannot assign array to reference held by property Foo::$bar of type int +TypeError: Cannot assign array to reference held by property Foo::$bar of type int float(0.5) float(20) -Cannot assign array to reference held by property Foo::$baz of type float +TypeError: Cannot assign array to reference held by property Foo::$baz of type float float(0.5) float(20) -Cannot assign array to reference held by property Foo::$privateProp of type float +TypeError: Cannot assign array to reference held by property Foo::$privateProp of type float diff --git a/Zend/tests/type_declarations/typed_properties_046.phpt b/Zend/tests/type_declarations/typed_properties_046.phpt index 2048455fe5f1..c66a69e334f4 100644 --- a/Zend/tests/type_declarations/typed_properties_046.phpt +++ b/Zend/tests/type_declarations/typed_properties_046.phpt @@ -18,13 +18,13 @@ for ($i = 0; $i < 5; $i++) { try { foo()->{bar()} = str_repeat("a", 3); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Cannot assign string to property Foo::$bbb of type int -Cannot assign string to property Foo::$bbb of type int -Cannot assign string to property Foo::$bbb of type int -Cannot assign string to property Foo::$bbb of type int -Cannot assign string to property Foo::$bbb of type int +TypeError: Cannot assign string to property Foo::$bbb of type int +TypeError: Cannot assign string to property Foo::$bbb of type int +TypeError: Cannot assign string to property Foo::$bbb of type int +TypeError: Cannot assign string to property Foo::$bbb of type int +TypeError: Cannot assign string to property Foo::$bbb of type int diff --git a/Zend/tests/type_declarations/typed_properties_047.phpt b/Zend/tests/type_declarations/typed_properties_047.phpt index 5de7b254d993..3e5bd90f832f 100644 --- a/Zend/tests/type_declarations/typed_properties_047.phpt +++ b/Zend/tests/type_declarations/typed_properties_047.phpt @@ -20,12 +20,12 @@ unset($x->foo); try { var_dump($x->foo); } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $x->foo = "ops"; } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- @@ -36,5 +36,5 @@ object(Foo)#1 (1) { NULL int(5) NULL -Typed property Foo::$foo must not be accessed before initialization -Cannot assign string to property Foo::$foo of type ?int +Error: Typed property Foo::$foo must not be accessed before initialization +TypeError: Cannot assign string to property Foo::$foo of type ?int diff --git a/Zend/tests/type_declarations/typed_properties_051.phpt b/Zend/tests/type_declarations/typed_properties_051.phpt index 37972c967b14..47103a4efac5 100644 --- a/Zend/tests/type_declarations/typed_properties_051.phpt +++ b/Zend/tests/type_declarations/typed_properties_051.phpt @@ -19,9 +19,9 @@ var_dump($o->a); try { $o->a = new C; } catch (Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(4) "okok" -Cannot assign C to property A::$a of type string +TypeError: Cannot assign C to property A::$a of type string diff --git a/Zend/tests/type_declarations/typed_properties_056.phpt b/Zend/tests/type_declarations/typed_properties_056.phpt index 868594b38adc..b62c7c969add 100644 --- a/Zend/tests/type_declarations/typed_properties_056.phpt +++ b/Zend/tests/type_declarations/typed_properties_056.phpt @@ -13,11 +13,11 @@ $o->foo = "1" . str_repeat("0", 2); try { $o->foo += 5; } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($o->foo); unset($o); ?> --EXPECT-- -Cannot assign int to property A::$foo of type string +TypeError: Cannot assign int to property A::$foo of type string string(3) "100" diff --git a/Zend/tests/type_declarations/typed_properties_057.phpt b/Zend/tests/type_declarations/typed_properties_057.phpt index eb565f0c36b4..140eaf4b45ef 100644 --- a/Zend/tests/type_declarations/typed_properties_057.phpt +++ b/Zend/tests/type_declarations/typed_properties_057.phpt @@ -13,19 +13,19 @@ $o->foo = "1" . str_repeat("0", 2); try { $x = ++$o->foo; } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($o->foo); try { $x = $o->foo++; } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($o->foo); unset($o); ?> --EXPECT-- -Cannot assign int to property A::$foo of type string +TypeError: Cannot assign int to property A::$foo of type string string(3) "100" -Cannot assign int to property A::$foo of type string +TypeError: Cannot assign int to property A::$foo of type string string(3) "100" diff --git a/Zend/tests/type_declarations/typed_properties_058.phpt b/Zend/tests/type_declarations/typed_properties_058.phpt index 47c75037d163..0934d7de0f6b 100644 --- a/Zend/tests/type_declarations/typed_properties_058.phpt +++ b/Zend/tests/type_declarations/typed_properties_058.phpt @@ -22,11 +22,11 @@ for ($i = 0; $i < 2; $i++) { $o = new B(); var_dump($o->foo); } catch (Throwable $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- int(5) -Cannot assign int to property B::$foo of type string -Cannot assign int to property B::$foo of type string +TypeError: Cannot assign int to property B::$foo of type string +TypeError: Cannot assign int to property B::$foo of type string diff --git a/Zend/tests/type_declarations/typed_properties_062.phpt b/Zend/tests/type_declarations/typed_properties_062.phpt index 6e1242e9901e..ba12c77a1845 100644 --- a/Zend/tests/type_declarations/typed_properties_062.phpt +++ b/Zend/tests/type_declarations/typed_properties_062.phpt @@ -18,7 +18,7 @@ var_dump($a->foo); try { $a->_ .= "e50"; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->foo); $a->_--; @@ -31,30 +31,30 @@ $a->foo = PHP_INT_MIN; try { $a->_--; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { --$a->_; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { $a->_++; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { ++$a->_; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->_ = 0; try { $a->_ = []; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->foo); $a->_ = 1; @@ -64,18 +64,18 @@ var_dump($a->foo); --EXPECT-- int(2) int(21) -Cannot assign string to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int int(21) int(20) int(19) -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value integer -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value integer -Cannot assign array to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int int(0) int(1) diff --git a/Zend/tests/type_declarations/typed_properties_063.phpt b/Zend/tests/type_declarations/typed_properties_063.phpt index b67e95c24b39..6a299a11afdf 100644 --- a/Zend/tests/type_declarations/typed_properties_063.phpt +++ b/Zend/tests/type_declarations/typed_properties_063.phpt @@ -17,7 +17,7 @@ var_dump($a->foo); try { $_ .= "e50"; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->foo); $_--; @@ -30,30 +30,30 @@ $a->foo = PHP_INT_MIN; try { $_--; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { --$_; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { $_++; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { ++$_; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $_ = 0; try { $_ = []; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->foo); $_ = 1; @@ -63,18 +63,18 @@ var_dump($a->foo); --EXPECT-- int(2) int(21) -Cannot assign string to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int int(21) int(20) int(19) -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value integer -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value integer -Cannot assign array to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int int(0) int(1) diff --git a/Zend/tests/type_declarations/typed_properties_064.phpt b/Zend/tests/type_declarations/typed_properties_064.phpt index dd7b5517a7f1..4880707f8f68 100644 --- a/Zend/tests/type_declarations/typed_properties_064.phpt +++ b/Zend/tests/type_declarations/typed_properties_064.phpt @@ -17,7 +17,7 @@ var_dump($a->foo); try { $_[0] .= "e50"; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->foo); $_[0]--; @@ -30,30 +30,30 @@ $a->foo = PHP_INT_MIN; try { $_[0]--; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { --$_[0]; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { $_[0]++; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { ++$_[0]; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $_[0] = 0; try { $_[0] = []; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->foo); $_[0] = 1; @@ -63,18 +63,18 @@ var_dump($a->foo); --EXPECT-- int(2) int(21) -Cannot assign string to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int int(21) int(20) int(19) -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value integer -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value integer -Cannot assign array to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int int(0) int(1) diff --git a/Zend/tests/type_declarations/typed_properties_065.phpt b/Zend/tests/type_declarations/typed_properties_065.phpt index a3a536da07e1..a4d0aa4c0c0c 100644 --- a/Zend/tests/type_declarations/typed_properties_065.phpt +++ b/Zend/tests/type_declarations/typed_properties_065.phpt @@ -31,24 +31,24 @@ $a->foo = PHP_INT_MIN; try { $a[0]--; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { --$a[0]; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; $a->foo = PHP_INT_MAX; try { $a[0]++; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; try { ++$a[0]; -} catch (Error $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } echo gettype($a->foo),"\n"; ?> @@ -61,11 +61,11 @@ offsetSet(1e50) int(1) int(0) int(-1) -Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value integer -Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value integer -Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value integer -Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value integer diff --git a/Zend/tests/type_declarations/typed_properties_068.phpt b/Zend/tests/type_declarations/typed_properties_068.phpt index 38597559cf04..f6c810b7c0fd 100644 --- a/Zend/tests/type_declarations/typed_properties_068.phpt +++ b/Zend/tests/type_declarations/typed_properties_068.phpt @@ -28,12 +28,12 @@ var_dump($i, Foo::$i); try { $i = null; -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($i, Foo::$i); try { Foo::$i = null; -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($i, Foo::$i); Foo::$s = &ref(5); @@ -44,17 +44,17 @@ var_dump(Foo::$i, ref()); try { Foo::$i = &ref("x"); -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::$i, ref()); try { Foo::$i = &Foo::$s; -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::$i, Foo::$s); try { Foo::$s = &Foo::$i; -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::$i, Foo::$s); ?> @@ -66,22 +66,22 @@ int(3) int(3) int(4) int(4) -Cannot assign null to reference held by property Foo::$i of type int +TypeError: Cannot assign null to reference held by property Foo::$i of type int int(4) int(4) -Cannot assign null to property Foo::$i of type int +TypeError: Cannot assign null to property Foo::$i of type int int(4) int(4) string(1) "5" string(1) "5" int(0) int(0) -Cannot assign string to property Foo::$i of type int +TypeError: Cannot assign string to property Foo::$i of type int int(0) string(1) "x" -Reference with value of type string held by property Foo::$s of type string is not compatible with property Foo::$i of type int +TypeError: Reference with value of type string held by property Foo::$s of type string is not compatible with property Foo::$i of type int int(0) string(1) "5" -Reference with value of type int held by property Foo::$i of type int is not compatible with property Foo::$s of type string +TypeError: Reference with value of type int held by property Foo::$i of type int is not compatible with property Foo::$s of type string int(0) string(1) "5" diff --git a/Zend/tests/type_declarations/typed_properties_069.phpt b/Zend/tests/type_declarations/typed_properties_069.phpt index 7d84407102d9..63c1d91e9ff1 100644 --- a/Zend/tests/type_declarations/typed_properties_069.phpt +++ b/Zend/tests/type_declarations/typed_properties_069.phpt @@ -14,14 +14,14 @@ class Foo { try { Foo::$i = &nonNumericStringRef(); -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(Foo::$i); -} catch (Error $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(nonNumericStringRef()); ?> --EXPECT-- -Cannot assign string to property Foo::$i of type int -Typed static property Foo::$i must not be accessed before initialization +TypeError: Cannot assign string to property Foo::$i of type int +Error: Typed static property Foo::$i must not be accessed before initialization string(1) "x" diff --git a/Zend/tests/type_declarations/typed_properties_070.phpt b/Zend/tests/type_declarations/typed_properties_070.phpt index d039fca3b143..bc3d33dd1bf8 100644 --- a/Zend/tests/type_declarations/typed_properties_070.phpt +++ b/Zend/tests/type_declarations/typed_properties_070.phpt @@ -29,12 +29,12 @@ var_dump(Foo::$i); try { Foo::$i += PHP_INT_MAX; -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::$i); try { Foo::$i .= PHP_INT_MAX; -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Foo::$i); ?> @@ -43,7 +43,7 @@ string(2) "11" string(2) "13" string(2) "12" int(1) -Cannot assign float to property Foo::$i of type int +TypeError: Cannot assign float to property Foo::$i of type int int(1) -Cannot assign string to property Foo::$i of type int +TypeError: Cannot assign string to property Foo::$i of type int int(1) diff --git a/Zend/tests/type_declarations/typed_properties_074.phpt b/Zend/tests/type_declarations/typed_properties_074.phpt index 3f98e72f7366..ce99618fb1c1 100644 --- a/Zend/tests/type_declarations/typed_properties_074.phpt +++ b/Zend/tests/type_declarations/typed_properties_074.phpt @@ -18,7 +18,7 @@ unset($test->val); var_dump($test); try { var_dump($test->val); -} catch (TypeError $e) { print $e->getMessage()."\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); $test->prop = "y"; @@ -32,7 +32,7 @@ object(Test)#1 (1) { ["val"]=> uninitialized(int) } -Value of type string returned from Test::__get() must be compatible with unset property Test::$val of type int +TypeError: Value of type string returned from Test::__get() must be compatible with unset property Test::$val of type int object(Test)#1 (1) { ["prop"]=> &string(1) "x" diff --git a/Zend/tests/type_declarations/typed_properties_075.phpt b/Zend/tests/type_declarations/typed_properties_075.phpt index 42e74ebce441..7e44798ef3ee 100644 --- a/Zend/tests/type_declarations/typed_properties_075.phpt +++ b/Zend/tests/type_declarations/typed_properties_075.phpt @@ -11,43 +11,43 @@ class Foo { try { Foo::$bar++; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump(Foo::$bar); try { Foo::$bar += 1; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump(Foo::$bar); try { ++Foo::$bar; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump(Foo::$bar); try { Foo::$bar = Foo::$bar + 1; -} catch(TypeError $t) { - var_dump($t->getMessage()); +} catch(Throwable $t) { + echo $t::class, ': ', $t->getMessage(), "\n"; } var_dump(Foo::$bar); ?> --EXPECT-- -string(70) "Cannot increment property Foo::$bar of type int past its maximal value" +TypeError: Cannot increment property Foo::$bar of type int past its maximal value int(9223372036854775807) -string(53) "Cannot assign float to property Foo::$bar of type int" +TypeError: Cannot assign float to property Foo::$bar of type int int(9223372036854775807) -string(70) "Cannot increment property Foo::$bar of type int past its maximal value" +TypeError: Cannot increment property Foo::$bar of type int past its maximal value int(9223372036854775807) -string(53) "Cannot assign float to property Foo::$bar of type int" +TypeError: Cannot assign float to property Foo::$bar of type int int(9223372036854775807) diff --git a/Zend/tests/type_declarations/typed_properties_076.phpt b/Zend/tests/type_declarations/typed_properties_076.phpt index b0d0bfedf808..9aab4a5b37f4 100644 --- a/Zend/tests/type_declarations/typed_properties_076.phpt +++ b/Zend/tests/type_declarations/typed_properties_076.phpt @@ -36,14 +36,14 @@ function valid(Test $test, string $prop1, string $prop2, $value) { try { $test->$prop2 = $value; $test->$prop1 =& $test->$prop2; - } catch (TypeError $e) { - echo "Valid assignment $prop1 =& $prop2 threw {$e->getMessage()}\n"; + } catch (Throwable $e) { + echo "Valid assignment $prop1 =& $prop2 ", $e::class, ': ', $e->getMessage(), "\n"; } try { $test->$prop1 = $value; $test->$prop2 =& $test->$prop1; - } catch (TypeError $e) { - echo "Valid assignment $prop2 =& $prop1 threw {$e->getMessage()}\n"; + } catch (Throwable $e) { + echo "Valid assignment $prop2 =& $prop1 ", $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/Zend/tests/type_declarations/typed_properties_078.phpt b/Zend/tests/type_declarations/typed_properties_078.phpt index 07e9384b6f54..346516b4b227 100644 --- a/Zend/tests/type_declarations/typed_properties_078.phpt +++ b/Zend/tests/type_declarations/typed_properties_078.phpt @@ -16,7 +16,7 @@ var_dump($ref); try { $a->t = &$ref; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ref); $a->it = [1]; // type is still assignable @@ -24,7 +24,7 @@ var_dump($ref); try { $ref = new ArrayIterator(); -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ref instanceof ArrayIterator); unset($a->a); @@ -35,7 +35,7 @@ $a->t = &$ref; try { $ref = []; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ref instanceof ArrayIterator); $ref = new ArrayIterator(); @@ -45,15 +45,15 @@ var_dump($ref instanceof ArrayIterator); --EXPECT-- array(0) { } -string(72) "Cannot assign array to property class@anonymous::$t of type ?Traversable" +TypeError: Cannot assign array to property class@anonymous::$t of type ?Traversable array(0) { } array(1) { [0]=> int(1) } -string(92) "Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array" +TypeError: Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array bool(false) -string(90) "Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable" +TypeError: Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable bool(false) bool(true) diff --git a/Zend/tests/type_declarations/typed_properties_079.phpt b/Zend/tests/type_declarations/typed_properties_079.phpt index d189cec6d4ce..17b569a27382 100644 --- a/Zend/tests/type_declarations/typed_properties_079.phpt +++ b/Zend/tests/type_declarations/typed_properties_079.phpt @@ -12,7 +12,7 @@ A::$a = &A::$it; try { A::$it = new ArrayIterator(); -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(A::$it); A::$a = &$a; @@ -21,13 +21,13 @@ A::$it = new ArrayIterator(); try { $a = 1; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a); ?> --EXPECT-- -string(78) "Cannot assign ArrayIterator to reference held by property A::$a of type ?array" +TypeError: Cannot assign ArrayIterator to reference held by property A::$a of type ?array array(0) { } -string(68) "Cannot assign int to reference held by property A::$a of type ?array" +TypeError: Cannot assign int to reference held by property A::$a of type ?array NULL diff --git a/Zend/tests/type_declarations/typed_properties_080.phpt b/Zend/tests/type_declarations/typed_properties_080.phpt index 58a17a1a965f..ec8a69654d26 100644 --- a/Zend/tests/type_declarations/typed_properties_080.phpt +++ b/Zend/tests/type_declarations/typed_properties_080.phpt @@ -11,18 +11,18 @@ class Test { static function run() { try { self::$a; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { self::$b; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { self::$c; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -31,6 +31,6 @@ Test::run(); ?> --EXPECT-- -Typed static property Test::$a must not be accessed before initialization -Typed static property Test::$b must not be accessed before initialization -Typed static property Test::$c must not be accessed before initialization +Error: Typed static property Test::$a must not be accessed before initialization +Error: Typed static property Test::$b must not be accessed before initialization +Error: Typed static property Test::$c must not be accessed before initialization diff --git a/Zend/tests/type_declarations/typed_properties_081.phpt b/Zend/tests/type_declarations/typed_properties_081.phpt index f6d2114c6f25..c5120e8822e3 100644 --- a/Zend/tests/type_declarations/typed_properties_081.phpt +++ b/Zend/tests/type_declarations/typed_properties_081.phpt @@ -13,10 +13,10 @@ $test2 = clone $test; unset($test); try { $x = "foo"; -} catch (TypeError $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test2->x); ?> --EXPECT-- -Cannot assign string to reference held by property Test::$x of type int +TypeError: Cannot assign string to reference held by property Test::$x of type int int(42) diff --git a/Zend/tests/type_declarations/typed_properties_082.phpt b/Zend/tests/type_declarations/typed_properties_082.phpt index d212f1852cbf..24cbfe7510d8 100644 --- a/Zend/tests/type_declarations/typed_properties_082.phpt +++ b/Zend/tests/type_declarations/typed_properties_082.phpt @@ -14,7 +14,7 @@ class Test2 extends Test { $x =& Test::$x; try { $x = "foo"; -} catch (TypeError $e) { echo $e->getMessage(), "\n"; } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($x, Test::$x); Test::$x =& Test2::$y; // remove the typed ref from $x @@ -23,7 +23,7 @@ var_dump($x, Test::$x); ?> --EXPECT-- -Cannot assign string to reference held by property Test::$x of type int +TypeError: Cannot assign string to reference held by property Test::$x of type int int(0) int(0) string(3) "foo" diff --git a/Zend/tests/type_declarations/typed_properties_083.phpt b/Zend/tests/type_declarations/typed_properties_083.phpt index f67eec302a4e..57b3cdea8ba7 100644 --- a/Zend/tests/type_declarations/typed_properties_083.phpt +++ b/Zend/tests/type_declarations/typed_properties_083.phpt @@ -17,15 +17,15 @@ var_dump($a->i); try { $a->p[] = "test"; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { // must be uninit var_dump($a->p); // WRONG! -} catch (Error $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } $a->p = null; try { $a->p[] = "test"; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($a->p); Foo::$a["bar"] = 2; @@ -33,10 +33,10 @@ var_dump(Foo::$a); try { Foo::$s["baz"][] = "baz"; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { // must be uninit var_dump(Foo::$s); -} catch (Error $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } Foo::$a = null; $ref = &Foo::$a; @@ -46,12 +46,12 @@ var_dump($ref); $ref = &$a->p; try { $ref[] = "bar"; -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ref); try { $ref["baz"][] = "bar"; // indirect assign -} catch (TypeError $e) { var_dump($e->getMessage()); } +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ref); ?> @@ -60,21 +60,21 @@ array(1) { [0]=> int(1) } -string(71) "Cannot auto-initialize an array inside property Foo::$p of type ?string" -string(65) "Typed property Foo::$p must not be accessed before initialization" -string(71) "Cannot auto-initialize an array inside property Foo::$p of type ?string" +TypeError: Cannot auto-initialize an array inside property Foo::$p of type ?string +Error: Typed property Foo::$p must not be accessed before initialization +TypeError: Cannot auto-initialize an array inside property Foo::$p of type ?string NULL array(1) { ["bar"]=> int(2) } -string(71) "Cannot auto-initialize an array inside property Foo::$s of type ?string" -string(72) "Typed static property Foo::$s must not be accessed before initialization" +TypeError: Cannot auto-initialize an array inside property Foo::$s of type ?string +Error: Typed static property Foo::$s must not be accessed before initialization array(1) { [0]=> int(3) } -string(91) "Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string" +TypeError: Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string NULL -string(91) "Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string" +TypeError: Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string NULL diff --git a/Zend/tests/type_declarations/typed_properties_093.phpt b/Zend/tests/type_declarations/typed_properties_093.phpt index 1f4bf4cb8cae..9881c4c17262 100644 --- a/Zend/tests/type_declarations/typed_properties_093.phpt +++ b/Zend/tests/type_declarations/typed_properties_093.phpt @@ -17,14 +17,14 @@ $test = new Test; $ref = "foobar"; try { $test->$name =& $ref; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); ?> --EXPECT-- -Cannot assign string to property Test::$prop of type int +TypeError: Cannot assign string to property Test::$prop of type int object(Test)#2 (0) { ["prop"]=> uninitialized(int) diff --git a/Zend/tests/type_declarations/typed_properties_095.phpt b/Zend/tests/type_declarations/typed_properties_095.phpt index 4d8e5168e15e..8c2858f30235 100644 --- a/Zend/tests/type_declarations/typed_properties_095.phpt +++ b/Zend/tests/type_declarations/typed_properties_095.phpt @@ -12,15 +12,15 @@ $obj = new _ZendTestClass; var_dump($obj->intProp); try { $obj->intProp = "foobar"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $obj->intProp = 456; try { $obj->classProp = $obj; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $obj->classProp = new stdClass; var_dump($obj); @@ -34,15 +34,15 @@ $obj = new Test; var_dump($obj->intProp); try { $obj->intProp = "foobar"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $obj->intProp = 456; try { $obj->classProp = $obj; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $obj->classProp = new stdClass; var_dump($obj); @@ -52,8 +52,8 @@ var_dump($obj); var_dump(_ZendTestClass::$staticIntProp); try { _ZendTestClass::$staticIntProp = "foobar"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } _ZendTestClass::$staticIntProp = 456; var_dump(_ZendTestClass::$staticIntProp); @@ -61,8 +61,8 @@ var_dump(_ZendTestClass::$staticIntProp); ?> --EXPECT-- int(123) -Cannot assign string to property _ZendTestClass::$intProp of type int -Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass +TypeError: Cannot assign string to property _ZendTestClass::$intProp of type int +TypeError: Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass object(_ZendTestClass)#1 (3) { ["intProp"]=> int(456) @@ -81,8 +81,8 @@ object(_ZendTestClass)#1 (3) { uninitialized(Iterator|(Traversable&Countable)) } int(123) -Cannot assign string to property _ZendTestClass::$intProp of type int -Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass +TypeError: Cannot assign string to property _ZendTestClass::$intProp of type int +TypeError: Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass object(Test)#4 (3) { ["intProp"]=> int(456) @@ -101,5 +101,5 @@ object(Test)#4 (3) { uninitialized(Iterator|(Traversable&Countable)) } int(123) -Cannot assign string to property _ZendTestClass::$staticIntProp of type int +TypeError: Cannot assign string to property _ZendTestClass::$staticIntProp of type int int(456) diff --git a/Zend/tests/type_declarations/typed_properties_096.phpt b/Zend/tests/type_declarations/typed_properties_096.phpt index 83f086d345a5..bc7cd2dfa151 100644 --- a/Zend/tests/type_declarations/typed_properties_096.phpt +++ b/Zend/tests/type_declarations/typed_properties_096.phpt @@ -13,8 +13,8 @@ $test->prop2 = 123; $ref =& $test->prop2; try { $test->prop =& $ref; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); @@ -31,7 +31,7 @@ var_dump($test); ?> --EXPECT-- -Cannot assign int to property Test1::$prop of type Foobar +TypeError: Cannot assign int to property Test1::$prop of type Foobar object(Test1)#1 (1) { ["prop"]=> uninitialized(Foobar) diff --git a/Zend/tests/type_declarations/typed_properties_097.phpt b/Zend/tests/type_declarations/typed_properties_097.phpt index 6697f2ad2755..139897527968 100644 --- a/Zend/tests/type_declarations/typed_properties_097.phpt +++ b/Zend/tests/type_declarations/typed_properties_097.phpt @@ -14,28 +14,28 @@ $test = new Test; $test->foo = PHP_INT_MIN; try { --$test->foo; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); try { $test->foo--; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); $test->foo = PHP_INT_MAX; try { ++$test->foo; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); try { $test->foo++; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); @@ -45,46 +45,46 @@ $ref =& $test->foo; $test->foo = PHP_INT_MIN; try { --$test->foo; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); try { $test->foo--; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); $test->foo = PHP_INT_MAX; try { ++$test->foo; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); try { $test->foo++; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test->foo); ?> --EXPECT-- -Cannot decrement property Test::$foo of type int past its minimal value +TypeError: Cannot decrement property Test::$foo of type int past its minimal value int(-9223372036854775808) -Cannot decrement property Test::$foo of type int past its minimal value +TypeError: Cannot decrement property Test::$foo of type int past its minimal value int(-9223372036854775808) -Cannot increment property Test::$foo of type int past its maximal value +TypeError: Cannot increment property Test::$foo of type int past its maximal value int(9223372036854775807) -Cannot increment property Test::$foo of type int past its maximal value +TypeError: Cannot increment property Test::$foo of type int past its maximal value int(9223372036854775807) -Cannot decrement a reference held by property Test::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property Test::$foo of type int past its minimal value int(-9223372036854775808) -Cannot decrement a reference held by property Test::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property Test::$foo of type int past its minimal value int(-9223372036854775808) -Cannot increment a reference held by property Test::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property Test::$foo of type int past its maximal value +int(9223372036854775807) +TypeError: Cannot increment a reference held by property Test::$foo of type int past its maximal value int(9223372036854775807) -Cannot increment a reference held by property Test::$foo of type int past its maximal value -int(9223372036854775807) \ No newline at end of file diff --git a/Zend/tests/type_declarations/typed_properties_102.phpt b/Zend/tests/type_declarations/typed_properties_102.phpt index 83f3c26186fc..82271d275897 100644 --- a/Zend/tests/type_declarations/typed_properties_102.phpt +++ b/Zend/tests/type_declarations/typed_properties_102.phpt @@ -11,12 +11,12 @@ class Test { Test::$prop =& Test::$intProp; try { Test::$prop .= "foobar"; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Test::$prop, Test::$intProp); ?> --EXPECT-- -Cannot assign string to reference held by property Test::$intProp of type int +TypeError: Cannot assign string to reference held by property Test::$intProp of type int int(123) int(123) diff --git a/Zend/tests/type_declarations/typed_properties_105.phpt b/Zend/tests/type_declarations/typed_properties_105.phpt index 747ff9f19052..98fca7ce7d9f 100644 --- a/Zend/tests/type_declarations/typed_properties_105.phpt +++ b/Zend/tests/type_declarations/typed_properties_105.phpt @@ -17,4 +17,3 @@ var_dump(array_key_exists('c', $defaults)); array(0) { } bool(false) - diff --git a/Zend/tests/type_declarations/typed_properties_106.phpt b/Zend/tests/type_declarations/typed_properties_106.phpt index 344cfa5349ee..fa114c5db00f 100644 --- a/Zend/tests/type_declarations/typed_properties_106.phpt +++ b/Zend/tests/type_declarations/typed_properties_106.phpt @@ -9,18 +9,18 @@ $obj = new Test; $ref =& $obj->prop; try { $ref = [1]; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ary = [1]; $ref = $ary; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($ref); ?> --EXPECT-- -Cannot assign array to reference held by property Test::$prop of type ?Type -Cannot assign array to reference held by property Test::$prop of type ?Type +TypeError: Cannot assign array to reference held by property Test::$prop of type ?Type +TypeError: Cannot assign array to reference held by property Test::$prop of type ?Type NULL diff --git a/Zend/tests/type_declarations/typed_properties_110.phpt b/Zend/tests/type_declarations/typed_properties_110.phpt index 6a108b4529c6..0a7608d244aa 100644 --- a/Zend/tests/type_declarations/typed_properties_110.phpt +++ b/Zend/tests/type_declarations/typed_properties_110.phpt @@ -11,10 +11,10 @@ $foo->value = null; try { $foo->value = 1; -} catch (\TypeError $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign int to property Foo::$value of type null +TypeError: Cannot assign int to property Foo::$value of type null diff --git a/Zend/tests/type_declarations/typed_properties_111.phpt b/Zend/tests/type_declarations/typed_properties_111.phpt index 20236e8a19bb..a5a1b664d0b3 100644 --- a/Zend/tests/type_declarations/typed_properties_111.phpt +++ b/Zend/tests/type_declarations/typed_properties_111.phpt @@ -11,10 +11,10 @@ $foo->value = false; try { $foo->value = true; -} catch (\TypeError $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign true to property Foo::$value of type false +TypeError: Cannot assign true to property Foo::$value of type false diff --git a/Zend/tests/type_declarations/typed_properties_112.phpt b/Zend/tests/type_declarations/typed_properties_112.phpt index 8b1157759fec..4d125295649f 100644 --- a/Zend/tests/type_declarations/typed_properties_112.phpt +++ b/Zend/tests/type_declarations/typed_properties_112.phpt @@ -10,10 +10,10 @@ $foo = new Foo(); try { $foo->value = false; -} catch (\TypeError $e) { - echo $e->getMessage(); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign false to property Foo::$value of type true +TypeError: Cannot assign false to property Foo::$value of type true diff --git a/Zend/tests/type_declarations/typed_properties_114.phpt b/Zend/tests/type_declarations/typed_properties_114.phpt index 5f3093dd3308..1d4b30184625 100644 --- a/Zend/tests/type_declarations/typed_properties_114.phpt +++ b/Zend/tests/type_declarations/typed_properties_114.phpt @@ -17,14 +17,14 @@ foreach ($obj as $k => &$v) { try { $v = []; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } foreach ($obj as $k => &$v) { try { $v = []; } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -32,10 +32,10 @@ var_dump($obj); ?> --EXPECTF-- Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d -Cannot assign array to reference held by property A::$foo of type string +TypeError: Cannot assign array to reference held by property A::$foo of type string Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d -Cannot assign array to reference held by property A::$foo of type string +TypeError: Cannot assign array to reference held by property A::$foo of type string object(A)#1 (1) { ["foo"]=> &string(3) "bar" diff --git a/Zend/tests/type_declarations/typed_properties_115.phpt b/Zend/tests/type_declarations/typed_properties_115.phpt index 6347ee0c35d6..d929fb60dc86 100644 --- a/Zend/tests/type_declarations/typed_properties_115.phpt +++ b/Zend/tests/type_declarations/typed_properties_115.phpt @@ -17,14 +17,14 @@ $obj = new A; try { foreach ($obj as $k => &$v) {} } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($obj); ?> --EXPECTF-- Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d -Cannot acquire reference to readonly property A::$foo +Error: Cannot acquire reference to readonly property A::$foo object(A)#1 (1) { ["foo"]=> string(3) "bar" diff --git a/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt b/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt index 72cff1058f22..3f8cf1748eff 100644 --- a/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt +++ b/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt @@ -11,8 +11,8 @@ class Test { $this->prop = 1; try { $this->prop = "foobar"; - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($this->prop); } @@ -24,7 +24,7 @@ $test->method(); ?> --EXPECT-- -Cannot assign string to property Test::$prop of type int +TypeError: Cannot assign string to property Test::$prop of type int int(1) -Cannot assign string to property Test::$prop of type int +TypeError: Cannot assign string to property Test::$prop of type int int(1) diff --git a/Zend/tests/type_declarations/typed_properties_class_loading.phpt b/Zend/tests/type_declarations/typed_properties_class_loading.phpt index a81bc5b4fe09..28f4518107f9 100644 --- a/Zend/tests/type_declarations/typed_properties_class_loading.phpt +++ b/Zend/tests/type_declarations/typed_properties_class_loading.phpt @@ -15,8 +15,8 @@ spl_autoload_register(function($class) { $test = new Test; try { $test->propX = new stdClass; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } if (true) { @@ -30,8 +30,8 @@ $test->propY = null; $r =& $test->propY; try { $test->propY = new stdClass; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } if (true) { @@ -43,9 +43,9 @@ var_dump($test->propY); ?> --EXPECT-- -Cannot assign stdClass to property Test::$propX of type X +TypeError: Cannot assign stdClass to property Test::$propX of type X object(X)#3 (0) { } -Cannot assign stdClass to property Test::$propY of type ?Y +TypeError: Cannot assign stdClass to property Test::$propY of type ?Y object(Y)#4 (0) { } diff --git a/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt b/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt index 5754591ce7d5..7c958137e40a 100644 --- a/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt +++ b/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt @@ -15,22 +15,22 @@ class Test { $test = new Test; try { $test->prop; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop = "foo"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Typed property Test::$prop must not be accessed before initialization -Cannot assign string to property Test::$prop of type int -Typed property Test::$prop must not be accessed before initialization +Error: Typed property Test::$prop must not be accessed before initialization +TypeError: Cannot assign string to property Test::$prop of type int +Error: Typed property Test::$prop must not be accessed before initialization diff --git a/Zend/tests/type_declarations/typed_properties_magic_set.phpt b/Zend/tests/type_declarations/typed_properties_magic_set.phpt index 70a7d4fe6f07..1e2cf13f2bb5 100644 --- a/Zend/tests/type_declarations/typed_properties_magic_set.phpt +++ b/Zend/tests/type_declarations/typed_properties_magic_set.phpt @@ -24,8 +24,8 @@ class Test { $test = new Test; try { var_dump($test->foo); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(isset($test->foo)); $test->foo = 42; @@ -61,7 +61,7 @@ $test->foo = 42; ?> --EXPECT-- -Typed property Test::$foo must not be accessed before initialization +Error: Typed property Test::$foo must not be accessed before initialization bool(false) int(42) __set foo = 42 diff --git a/Zend/tests/type_declarations/union_types/anonymous_class.phpt b/Zend/tests/type_declarations/union_types/anonymous_class.phpt index 1e009f22b00f..1ffec32de05e 100644 --- a/Zend/tests/type_declarations/union_types/anonymous_class.phpt +++ b/Zend/tests/type_declarations/union_types/anonymous_class.phpt @@ -16,15 +16,15 @@ $a = new class { try { $a->testParam(null); } catch (\Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $a->test(); } catch (\Throwable $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d -class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned +TypeError: class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d +TypeError: class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned diff --git a/Zend/tests/type_declarations/union_types/incdec_prop.phpt b/Zend/tests/type_declarations/union_types/incdec_prop.phpt index 7b61fc9fe60c..62beef9befef 100644 --- a/Zend/tests/type_declarations/union_types/incdec_prop.phpt +++ b/Zend/tests/type_declarations/union_types/incdec_prop.phpt @@ -55,61 +55,61 @@ var_dump(is_float($test->prop)); try { $test->prop2 = PHP_INT_MAX; $x = $test->prop2++; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MAX; $x = ++$test->prop2; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MIN; $x = $test->prop2--; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MIN; $x = --$test->prop2; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MAX; $r =& $test->prop2; $x = $test->prop2++; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MAX; $r =& $test->prop2; $x = ++$test->prop2; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MIN; $r =& $test->prop2; $x = $test->prop2--; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->prop2 = PHP_INT_MIN; $r =& $test->prop2; $x = --$test->prop2; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -122,11 +122,11 @@ bool(true) bool(true) bool(true) bool(true) -Cannot increment property Test::$prop2 of type int|bool past its maximal value -Cannot increment property Test::$prop2 of type int|bool past its maximal value -Cannot decrement property Test::$prop2 of type int|bool past its minimal value -Cannot decrement property Test::$prop2 of type int|bool past its minimal value -Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value -Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value -Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value -Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value +TypeError: Cannot increment property Test::$prop2 of type int|bool past its maximal value +TypeError: Cannot increment property Test::$prop2 of type int|bool past its maximal value +TypeError: Cannot decrement property Test::$prop2 of type int|bool past its minimal value +TypeError: Cannot decrement property Test::$prop2 of type int|bool past its minimal value +TypeError: Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value +TypeError: Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value +TypeError: Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value +TypeError: Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value diff --git a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt index 9841e34ff90d..81aa4079bc8c 100644 --- a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt +++ b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt @@ -12,8 +12,8 @@ $obj->classUnionProp = new stdClass; $obj->classUnionProp = new ArrayIterator; try { $obj->classUnionProp = new DateTime; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $obj = new C; @@ -21,11 +21,11 @@ $obj->classUnionProp = new stdClass; $obj->classUnionProp = new ArrayIterator; try { $obj->classUnionProp = new DateTime; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null -Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null +TypeError: Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null +TypeError: Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null diff --git a/Zend/tests/type_declarations/union_types/multiple_classes.phpt b/Zend/tests/type_declarations/union_types/multiple_classes.phpt index b45fc02d83fa..d507550db434 100644 --- a/Zend/tests/type_declarations/union_types/multiple_classes.phpt +++ b/Zend/tests/type_declarations/union_types/multiple_classes.phpt @@ -27,14 +27,14 @@ var_dump($test->method("42")); try { $test->prop = new stdClass; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $test->method(new stdClass); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } if (true) { @@ -67,8 +67,8 @@ int(42) int(42) int(42) int(42) -Cannot assign stdClass to property Test::$prop of type X|Y|Z|int -Test::method(): Argument #1 ($arg) must be of type X|Y|Z|int, stdClass given, called in %s on line %d +TypeError: Cannot assign stdClass to property Test::$prop of type X|Y|Z|int +TypeError: Test::method(): Argument #1 ($arg) must be of type X|Y|Z|int, stdClass given, called in %s on line %d object(X)#4 (0) { } object(X)#6 (0) { diff --git a/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt b/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt index a8db8fca9cd5..ac2b2da19f01 100644 --- a/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt +++ b/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt @@ -16,16 +16,16 @@ $test->y =& $r; $v = 42; try { $r = $v; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($r, $v); $v = 42.0; try { $r = $v; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($r, $v); @@ -34,8 +34,8 @@ unset($r, $test->x, $test->y); $test->x = 42; try { $test->y =& $test->x; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($test->x, $test->y); @@ -43,17 +43,17 @@ unset($test->x, $test->y); $test->y = 42.0; try { $test->x =& $test->y; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Cannot assign int to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion +TypeError: Cannot assign int to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion string(6) "foobar" int(42) -Cannot assign float to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion +TypeError: Cannot assign float to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion string(6) "foobar" float(42) -Reference with value of type int held by property Test::$x of type string|int is not compatible with property Test::$y of type string|float -Reference with value of type float held by property Test::$y of type string|float is not compatible with property Test::$x of type string|int +TypeError: Reference with value of type int held by property Test::$x of type string|int is not compatible with property Test::$y of type string|float +TypeError: Reference with value of type float held by property Test::$y of type string|float is not compatible with property Test::$x of type string|int diff --git a/Zend/tests/type_declarations/variance/loading_exception1.phpt b/Zend/tests/type_declarations/variance/loading_exception1.phpt index ea5be4e56f05..e043136b161d 100644 --- a/Zend/tests/type_declarations/variance/loading_exception1.phpt +++ b/Zend/tests/type_declarations/variance/loading_exception1.phpt @@ -12,8 +12,8 @@ for ($i = 0; $i < 2; $i++) { try { class B extends A { } - } catch (Exception $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -33,14 +33,14 @@ spl_autoload_register(function($class) { try { class B extends A implements I { } -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Class A does not exist -Class A does not exist +Exception: Class A does not exist +Exception: Class A does not exist Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class A does not exist in %s:%d Stack trace: diff --git a/Zend/tests/type_declarations/variance/loading_exception2.phpt b/Zend/tests/type_declarations/variance/loading_exception2.phpt index db9c6b276581..f2b5500f2b39 100644 --- a/Zend/tests/type_declarations/variance/loading_exception2.phpt +++ b/Zend/tests/type_declarations/variance/loading_exception2.phpt @@ -14,8 +14,8 @@ for ($i = 0; $i < 2; $i++) { try { class B extends A implements I { } - } catch (Exception $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -35,14 +35,14 @@ spl_autoload_register(function($class) { try { class B extends A implements I, J { } -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -Class I does not exist -Class I does not exist +Exception: Class I does not exist +Exception: Class I does not exist Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class I does not exist in %s:%d Stack trace: diff --git a/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt b/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt index 2b5a9c8423eb..294e861d1662 100644 --- a/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt +++ b/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt @@ -10,10 +10,10 @@ 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"; } ?> --EXPECT-- -Class "B" not found +Error: Class "B" not found diff --git a/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt b/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt index 247e1cf2b10b..659b5ebed7f4 100644 --- a/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt +++ b/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt @@ -10,10 +10,10 @@ spl_autoload_register(function($class) { try { interface B extends A { } -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Interface "B" not found +Error: Interface "B" not found diff --git a/Zend/tests/undef_index_to_exception.phpt b/Zend/tests/undef_index_to_exception.phpt index bbe13c0e71d0..8416685fedbf 100644 --- a/Zend/tests/undef_index_to_exception.phpt +++ b/Zend/tests/undef_index_to_exception.phpt @@ -10,37 +10,37 @@ set_error_handler(function($_, $msg) { $test = []; try { $test[0] .= "xyz"; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); try { $test["key"] .= "xyz"; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($test); unset($test); try { $GLOBALS["test"] .= "xyz"; -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($test); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined array key 0 +Exception: Undefined array key 0 array(0) { } -Undefined array key "key" +Exception: Undefined array key "key" array(0) { } -Undefined global variable $test -Undefined variable $test +Exception: Undefined global variable $test +Exception: Undefined variable $test diff --git a/Zend/tests/undefined_multidimensional_array.phpt b/Zend/tests/undefined_multidimensional_array.phpt index 6593d6ba4ad4..b74e03e056e6 100644 --- a/Zend/tests/undefined_multidimensional_array.phpt +++ b/Zend/tests/undefined_multidimensional_array.phpt @@ -11,16 +11,16 @@ $arr[1][2][3][4][5]->foo; try { $arr[1][2][3][4][5]->foo = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $arr[][] = 2; try { $arr[][]->bar = 2; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -62,5 +62,5 @@ Warning: Trying to access array offset on null in %s on line %d Warning: Trying to access array offset on null in %s on line %d Warning: Attempt to read property "foo" on null in %s on line %d -Attempt to assign property "foo" on null -Attempt to assign property "bar" on null +Error: Attempt to assign property "foo" on null +Error: Attempt to assign property "bar" on null diff --git a/Zend/tests/unpack_iterator_by_ref_type_check.phpt b/Zend/tests/unpack_iterator_by_ref_type_check.phpt index 2fef31056bdc..742d3ab1a9ad 100644 --- a/Zend/tests/unpack_iterator_by_ref_type_check.phpt +++ b/Zend/tests/unpack_iterator_by_ref_type_check.phpt @@ -9,10 +9,10 @@ function gen() { } try { test(...gen()); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Cannot pass by-reference argument 1 of test() by unpacking a Traversable, passing by-value instead in %s on line %d -test(): Argument #1 ($a) must be of type T, null given, called in %s on line %d +TypeError: test(): Argument #1 ($a) must be of type T, null given, called in %s on line %d diff --git a/Zend/tests/unset/unset_non_array.phpt b/Zend/tests/unset/unset_non_array.phpt index 5d7ad4d44b87..e3d1ed2fa263 100644 --- a/Zend/tests/unset/unset_non_array.phpt +++ b/Zend/tests/unset/unset_non_array.phpt @@ -14,36 +14,36 @@ unset($x[0]); $x = true; try { unset($x[0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = 1; try { unset($x[0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = 3.14; try { unset($x[0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = "str"; try { unset($x[0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = new stdClass; try { unset($x[0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // And now repeat the same with a nested offset. @@ -60,36 +60,36 @@ unset($x[0][0]); $x = true; try { unset($x[0][0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = 1; try { unset($x[0][0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = 3.14; try { unset($x[0][0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = "str"; try { unset($x[0][0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $x = new stdClass; try { unset($x[0][0]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -97,17 +97,17 @@ try { Warning: Undefined variable $x in %s on line %d Deprecated: Automatic conversion of false to array is deprecated in %s -Cannot unset offset in a non-array variable -Cannot unset offset in a non-array variable -Cannot unset offset in a non-array variable -Cannot unset string offsets -Cannot use object of type stdClass as array +Error: Cannot unset offset in a non-array variable +Error: Cannot unset offset in a non-array variable +Error: Cannot unset offset in a non-array variable +Error: Cannot unset string offsets +Error: Cannot use object of type stdClass as array Warning: Undefined variable $x in %s on line %d Deprecated: Automatic conversion of false to array is deprecated in %s -Cannot unset offset in a non-array variable -Cannot unset offset in a non-array variable -Cannot unset offset in a non-array variable -Cannot use string offset as an array -Cannot use object of type stdClass as array +Error: Cannot unset offset in a non-array variable +Error: Cannot unset offset in a non-array variable +Error: Cannot unset offset in a non-array variable +Error: Cannot use string offset as an array +Error: Cannot use object of type stdClass as array diff --git a/Zend/tests/varSyntax/constant_object_deref.phpt b/Zend/tests/varSyntax/constant_object_deref.phpt index b25d6557440d..0bc77f114925 100644 --- a/Zend/tests/varSyntax/constant_object_deref.phpt +++ b/Zend/tests/varSyntax/constant_object_deref.phpt @@ -8,17 +8,17 @@ class Bar { const FOO = "foo"; } try { FOO->length(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Bar::FOO->length(); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Call to a member function length() on string -Call to a member function length() on string +Error: Call to a member function length() on string +Error: Call to a member function length() on string diff --git a/Zend/tests/varSyntax/encapsed_string_deref.phpt b/Zend/tests/varSyntax/encapsed_string_deref.phpt index 386e15932e6b..cb21e879471e 100644 --- a/Zend/tests/varSyntax/encapsed_string_deref.phpt +++ b/Zend/tests/varSyntax/encapsed_string_deref.phpt @@ -8,8 +8,8 @@ var_dump("foo$bar"[0]); var_dump("foo$bar"->prop); try { var_dump("foo$bar"->method()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } class FooBar { public static $prop = 42; } @@ -24,6 +24,6 @@ string(1) "f" Warning: Attempt to read property "prop" on string in %s on line %d NULL -Call to a member function method() on string +Error: Call to a member function method() on string int(42) int(42) diff --git a/Zend/tests/varSyntax/magic_const_deref.phpt b/Zend/tests/varSyntax/magic_const_deref.phpt index 54a5c95069ce..d227e2e013a9 100644 --- a/Zend/tests/varSyntax/magic_const_deref.phpt +++ b/Zend/tests/varSyntax/magic_const_deref.phpt @@ -8,8 +8,8 @@ function test() { var_dump(__FUNCTION__->prop); try { __FUNCTION__->method(); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -21,4 +21,4 @@ string(1) "t" Warning: Attempt to read property "prop" on string in %s on line %d NULL -Call to a member function method() on string +Error: Call to a member function method() on string diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt index 7cbc02bf581c..fd9d304f1b27 100644 --- a/Zend/tests/variadic/typehint_suppressed_error.phpt +++ b/Zend/tests/variadic/typehint_suppressed_error.phpt @@ -9,10 +9,10 @@ function test(array... $args) { try { test([0], [1], 2); -} catch(Error $e) { - var_dump($e->getMessage()); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -string(%d) "test(): Argument #3 must be of type array, int given, called in %s on line %d" +TypeError: test(): Argument #3 must be of type array, int given, called in %s on line %d diff --git a/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt index dd3c84518eac..830d1741fce8 100644 --- a/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt +++ b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt @@ -42,8 +42,8 @@ var_dump(isset($map[$obj])); var_dump(!empty($map[$obj])); try { var_dump($map[$obj]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // It's okay to unset an object that's not in the map. @@ -138,7 +138,7 @@ object(WeakMap)#1 (0) { } bool(false) bool(false) -Object stdClass#2 not contained in WeakMap +Error: Object stdClass#2 not contained in WeakMap Indirect modification: object(WeakMap)#1 (2) { diff --git a/Zend/tests/weakrefs/weakmap_error_conditions.phpt b/Zend/tests/weakrefs/weakmap_error_conditions.phpt index 2516c0443fd1..a903048fb148 100644 --- a/Zend/tests/weakrefs/weakmap_error_conditions.phpt +++ b/Zend/tests/weakrefs/weakmap_error_conditions.phpt @@ -6,39 +6,39 @@ WeakMap error conditions $map = new WeakMap; try { $map[1] = 2; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($map[1]); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($map[1]); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($map[1]); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $map[] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $map[][1] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($map[new stdClass]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($map->prop); @@ -47,46 +47,46 @@ unset($map->prop); try { $map->prop = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $map->prop[] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r =& $map->prop; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { serialize($map); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('C:7:"WeakMap":0:{}'); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -WeakMap key must be an object -WeakMap key must be an object -WeakMap key must be an object -WeakMap key must be an object -Cannot append to WeakMap -Cannot append to WeakMap -Object stdClass#2 not contained in WeakMap +TypeError: WeakMap key must be an object +TypeError: WeakMap key must be an object +TypeError: WeakMap key must be an object +TypeError: WeakMap key must be an object +Error: Cannot append to WeakMap +Error: Cannot append to WeakMap +Error: Object stdClass#2 not contained in WeakMap Warning: Undefined property: WeakMap::$prop in %s on line %d NULL bool(false) -Cannot create dynamic property WeakMap::$prop -Cannot create dynamic property WeakMap::$prop -Cannot create dynamic property WeakMap::$prop -Serialization of 'WeakMap' is not allowed -Unserialization of 'WeakMap' is not allowed +Error: Cannot create dynamic property WeakMap::$prop +Error: Cannot create dynamic property WeakMap::$prop +Error: Cannot create dynamic property WeakMap::$prop +Exception: Serialization of 'WeakMap' is not allowed +Exception: Unserialization of 'WeakMap' is not allowed diff --git a/Zend/tests/weakrefs/weakrefs_002.phpt b/Zend/tests/weakrefs/weakrefs_002.phpt index eda6b25ec786..622c55de1546 100644 --- a/Zend/tests/weakrefs/weakrefs_002.phpt +++ b/Zend/tests/weakrefs/weakrefs_002.phpt @@ -6,18 +6,18 @@ $wr = WeakReference::create(new stdClass); try { serialize($wr); -} catch (Exception $ex) { - var_dump($ex->getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } $wrs = 'O:13:"WeakReference":0:{}'; try { var_dump(unserialize($wrs)); -} catch (Exception $ex) { - var_dump($ex->getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -string(47) "Serialization of 'WeakReference' is not allowed" -string(49) "Unserialization of 'WeakReference' is not allowed" +Exception: Serialization of 'WeakReference' is not allowed +Exception: Unserialization of 'WeakReference' is not allowed diff --git a/Zend/tests/weakrefs/weakrefs_003.phpt b/Zend/tests/weakrefs/weakrefs_003.phpt index 42fe0560a71f..441b856ef3a0 100644 --- a/Zend/tests/weakrefs/weakrefs_003.phpt +++ b/Zend/tests/weakrefs/weakrefs_003.phpt @@ -10,19 +10,19 @@ unset($wr->disallow); try { $wr->disallow = "writes"; -} catch (Error $ex) { - var_dump($ex->getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { $disallow = &$wr->disallowed; -} catch (Error $ex) { - var_dump($ex->getMessage()); +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined property: WeakReference::$disallow in %s on line %d NULL bool(false) -string(55) "Cannot create dynamic property WeakReference::$disallow" -string(57) "Cannot create dynamic property WeakReference::$disallowed" +Error: Cannot create dynamic property WeakReference::$disallow +Error: Cannot create dynamic property WeakReference::$disallowed diff --git a/Zend/tests/weakrefs/weakrefs_006.phpt b/Zend/tests/weakrefs/weakrefs_006.phpt index a15ab6b542d5..dc432665d5c1 100644 --- a/Zend/tests/weakrefs/weakrefs_006.phpt +++ b/Zend/tests/weakrefs/weakrefs_006.phpt @@ -113,4 +113,4 @@ object(WeakMap)#1 (11) { ["value"]=> int(9) } -} \ No newline at end of file +} diff --git a/Zend/tests/xor_001.phpt b/Zend/tests/xor_001.phpt index 9678af16b5f7..82c592426e0c 100644 --- a/Zend/tests/xor_001.phpt +++ b/Zend/tests/xor_001.phpt @@ -8,12 +8,12 @@ $b = array(); try { $c = $a ^ $b; -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECT-- -Unsupported operand types: array ^ array +TypeError: Unsupported operand types: array ^ array Done diff --git a/Zend/tests/zpp/iterable_or_null.phpt b/Zend/tests/zpp/iterable_or_null.phpt index a44e858bce92..ab5fc170aec7 100644 --- a/Zend/tests/zpp/iterable_or_null.phpt +++ b/Zend/tests/zpp/iterable_or_null.phpt @@ -7,20 +7,20 @@ zend_test try { var_dump(zend_iterable("string")); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(zend_iterable(1)); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(zend_iterable(null)); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } @@ -34,14 +34,13 @@ zend_iterable($iterator, null); try { var_dump(zend_iterable([], "string")); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, string given -zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, int given -zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, null given -zend_iterable(): Argument #2 ($arg2) must be of type Traversable|array|null, string given - +TypeError: zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, string given +TypeError: zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, int given +TypeError: zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, null given +TypeError: zend_iterable(): Argument #2 ($arg2) must be of type Traversable|array|null, string given From 1dfd465607d2adb73d73610a9067de5c9b17cfb7 Mon Sep 17 00:00:00 2001 From: NickSdot <32384907+NickSdot@users.noreply.github.com> Date: Sat, 22 Aug 2026 20:28:13 +0700 Subject: [PATCH 21/27] tests: asserted error classes for test introduced in #23123 (#23179) --- Zend/tests/gh23121.phpt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Zend/tests/gh23121.phpt b/Zend/tests/gh23121.phpt index 158794ba04e3..b1a6503a8913 100644 --- a/Zend/tests/gh23121.phpt +++ b/Zend/tests/gh23121.phpt @@ -10,27 +10,27 @@ var_dump(is_callable($sxe)); try { $sxe(); -} catch (Error $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { call_user_func($sxe); -} catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { libxml_set_external_entity_loader($sxe); -} catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(libxml_get_external_entity_loader()); ?> --EXPECT-- bool(false) -Object of type SimpleXMLElement is not callable -call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given -libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, no array or string given +Error: Object of type SimpleXMLElement is not callable +TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given +TypeError: libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, no array or string given NULL From 7268b84ec1aef301f991a4d3c2f572e2ec051413 Mon Sep 17 00:00:00 2001 From: Steve Wilton Date: Sat, 11 Jul 2026 13:00:38 +0800 Subject: [PATCH 22/27] snmp: use book type for boolean options and rename variables --- ext/snmp/php_snmp.h | 6 +++--- ext/snmp/snmp.c | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h index d889eb37ab95..a9a7926504f5 100644 --- a/ext/snmp/php_snmp.h +++ b/ext/snmp/php_snmp.h @@ -46,11 +46,11 @@ typedef struct _php_snmp_object { struct snmp_session *session; int max_oids; int valueretrieval; - int quick_print; - int enum_print; + bool quick_print; + bool enum_print; int oid_output_format; int snmp_errno; - int oid_increasing_check; + bool oid_increasing_check; int exceptions_enabled; char snmp_errstr[256]; zend_object zo; diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index e921adb98352..54d2b1f5ac79 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1502,13 +1502,13 @@ PHP_FUNCTION(snmp_get_quick_print) /* {{{ Return all objects including their respective object id within the specified one */ PHP_FUNCTION(snmp_set_quick_print) { - bool a1; + bool quick_print; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &quick_print) == FAILURE) { RETURN_THROWS(); } - netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, (int)a1); + netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, (int)quick_print); RETURN_TRUE; } /* }}} */ @@ -1516,13 +1516,13 @@ PHP_FUNCTION(snmp_set_quick_print) /* {{{ Return all values that are enums with their enum value instead of the raw integer */ PHP_FUNCTION(snmp_set_enum_print) { - bool a1; + bool enum_print; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &enum_print) == FAILURE) { RETURN_THROWS(); } - netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM, (int) a1); + netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM, (int)enum_print); RETURN_TRUE; } /* }}} */ @@ -1530,20 +1530,20 @@ PHP_FUNCTION(snmp_set_enum_print) /* {{{ Set the OID output format. */ PHP_FUNCTION(snmp_set_oid_output_format) { - zend_long a1; + zend_long format; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &format) == FAILURE) { RETURN_THROWS(); } - switch (a1) { + switch (format) { case NETSNMP_OID_OUTPUT_SUFFIX: case NETSNMP_OID_OUTPUT_MODULE: case NETSNMP_OID_OUTPUT_FULL: case NETSNMP_OID_OUTPUT_NUMERIC: case NETSNMP_OID_OUTPUT_UCD: case NETSNMP_OID_OUTPUT_NONE: - netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, a1); + netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, format); RETURN_TRUE; default: zend_argument_value_error(1, "must be an SNMP_OID_OUTPUT_* constant"); @@ -1696,14 +1696,14 @@ PHP_METHOD(SNMP, __construct) { php_snmp_object *snmp_object; zval *object = ZEND_THIS; - zend_string *a1, *a2; + zend_string *hostname, *community; zend_long timeout = SNMP_DEFAULT_TIMEOUT; zend_long retries = SNMP_DEFAULT_RETRIES; zend_long version = SNMP_DEFAULT_VERSION; snmp_object = Z_SNMP_P(object); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "lPP|ll", &version, &a1, &a2, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "lPP|ll", &version, &hostname, &community, &timeout, &retries) == FAILURE) { RETURN_THROWS(); } @@ -1722,7 +1722,7 @@ PHP_METHOD(SNMP, __construct) snmp_session_free(&(snmp_object->session)); } - if (!snmp_session_init(&(snmp_object->session), version, a1, a2, timeout, retries, 2, 4)) { + if (!snmp_session_init(&(snmp_object->session), version, hostname, community, timeout, retries, 2, 4)) { return; } snmp_object->max_oids = 0; From fe77a737c0afe282914ffcdd3204fe9fac2fd1d9 Mon Sep 17 00:00:00 2001 From: Steve Wilton Date: Sat, 11 Jul 2026 13:07:21 +0800 Subject: [PATCH 23/27] snmp: use zend_result return type for functions returning SUCCESS/FAILURE --- ext/snmp/snmp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 54d2b1f5ac79..633e74a66afb 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1995,7 +1995,7 @@ static zval *php_snmp_get_property_ptr_ptr(zend_object *object, zend_string *nam } /* {{{ */ -static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval) +static zend_result php_snmp_read_info(php_snmp_object *snmp_object, zval *retval) { zval val; @@ -2019,7 +2019,7 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval) /* }}} */ /* {{{ */ -static int php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval) +static zend_result php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval) { if (snmp_object->max_oids > 0) { ZVAL_LONG(retval, snmp_object->max_oids); @@ -2031,7 +2031,7 @@ static int php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval) /* }}} */ #define PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(name) \ - static int php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval) \ + static zend_result php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval) \ { \ ZVAL_BOOL(retval, snmp_object->name); \ return SUCCESS; \ @@ -2042,7 +2042,7 @@ PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(quick_print) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(enum_print) #define PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(name) \ - static int php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval) \ + static zend_result php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval) \ { \ ZVAL_LONG(retval, snmp_object->name); \ return SUCCESS; \ @@ -2053,7 +2053,7 @@ PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(oid_output_format) PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(exceptions_enabled) /* {{{ */ -static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval) +static zend_result php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval) { zend_long lval; @@ -2075,7 +2075,7 @@ static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval) /* }}} */ /* {{{ */ -static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *newval) +static zend_result php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *newval) { zend_long lval = zval_get_long(newval); @@ -2091,7 +2091,7 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new /* }}} */ #define PHP_SNMP_BOOL_PROPERTY_WRITER_FUNCTION(name) \ -static int php_snmp_write_##name(php_snmp_object *snmp_object, zval *newval) \ +static zend_result php_snmp_write_##name(php_snmp_object *snmp_object, zval *newval) \ { \ zval ztmp; \ ZVAL_COPY(&ztmp, newval); \ @@ -2108,7 +2108,7 @@ PHP_SNMP_BOOL_PROPERTY_WRITER_FUNCTION(enum_print) PHP_SNMP_BOOL_PROPERTY_WRITER_FUNCTION(oid_increasing_check) /* {{{ */ -static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval *newval) +static zend_result php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval *newval) { zend_long lval = zval_get_long(newval); @@ -2129,13 +2129,11 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval * /* }}} */ /* {{{ */ -static int php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval *newval) +static zend_result php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval *newval) { - int ret = SUCCESS; - snmp_object->exceptions_enabled = zval_get_long(newval); - return ret; + return SUCCESS; } /* }}} */ From 79c11935fa3550181583b3ca306ccd39949ade48 Mon Sep 17 00:00:00 2001 From: Steve Wilton Date: Sat, 11 Jul 2026 15:52:29 +0800 Subject: [PATCH 24/27] snmp: update php_snmp_write_t and php_snmp_read_t to use zend_result return type --- ext/snmp/php_snmp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h index a9a7926504f5..c5376ee2e1b2 100644 --- a/ext/snmp/php_snmp.h +++ b/ext/snmp/php_snmp.h @@ -60,8 +60,8 @@ typedef struct _php_snmp_object { #define Z_SNMP_P(zv) php_snmp_fetch_object(Z_OBJ_P((zv))) -typedef int (*php_snmp_read_t)(php_snmp_object *snmp_object, zval *retval); -typedef int (*php_snmp_write_t)(php_snmp_object *snmp_object, zval *newval); +typedef zend_result (*php_snmp_read_t)(php_snmp_object *snmp_object, zval *retval); +typedef zend_result (*php_snmp_write_t)(php_snmp_object *snmp_object, zval *newval); typedef struct _ptp_snmp_prop_handler { const char *name; From d7bfcb2ea6c4be63db2f216d7c1c628101100db2 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sat, 22 Aug 2026 13:34:59 +0100 Subject: [PATCH 25/27] snmp: use size_t type instead of int type --- ext/snmp/snmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 633e74a66afb..ad04718910c4 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -238,8 +238,8 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval, int val char sbuf[512]; char *buf = &(sbuf[0]); char *dbuf = (char *)NULL; - int buflen = sizeof(sbuf) - 1; - int val_len = vars->val_len; + size_t buflen = sizeof(sbuf) - 1; + size_t val_len = vars->val_len; /* use emalloc() for large values, use static array otherwise */ From 62756c367eea32443c2812d10b20d468d723cd7f Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sat, 22 Aug 2026 13:35:49 +0100 Subject: [PATCH 26/27] snmp: use bool type instead of int type --- ext/snmp/snmp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index ad04718910c4..1a2770cd3380 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1265,7 +1265,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) zend_long retries = SNMP_DEFAULT_RETRIES; struct objid_query objid_query; php_snmp_session *session; - int session_less_mode = (getThis() == NULL); + bool session_less_mode = (getThis() == NULL); uint32_t timeout_arg_num = 0; uint32_t oid_arg_num = 1, type_arg_num = 0, value_arg_num = 0; php_snmp_object *snmp_object; @@ -1918,17 +1918,17 @@ static int php_snmp_has_property(zend_object *object, zend_string *name, int has { zval rv; php_snmp_prop_handler *hnd; - int ret = 0; + bool ret = false; if ((hnd = zend_hash_find_ptr(&php_snmp_properties, name)) != NULL) { switch (has_set_exists) { case ZEND_PROPERTY_EXISTS: - ret = 1; + ret = true; break; case ZEND_PROPERTY_ISSET: { zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (value != &EG(uninitialized_zval)) { - ret = Z_TYPE_P(value) != IS_NULL? 1 : 0; + ret = Z_TYPE_P(value) != IS_NULL; zval_ptr_dtor(value); } break; @@ -1937,7 +1937,7 @@ static int php_snmp_has_property(zend_object *object, zend_string *name, int has zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (value != &EG(uninitialized_zval)) { convert_to_boolean(value); - ret = Z_TYPE_P(value) == IS_TRUE? 1:0; + ret = Z_TYPE_P(value) == IS_TRUE; } break; } From 16b3863d7ddd00872dcf6f2bbf5bb476174d0de2 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sat, 22 Aug 2026 13:36:38 +0100 Subject: [PATCH 27/27] snmp: use zend_result type instead of int type --- ext/snmp/snmp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 1a2770cd3380..bcca8d44de89 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1859,13 +1859,12 @@ zval *php_snmp_read_property(zend_object *object, zend_string *name, int type, v zval *retval; php_snmp_object *obj; php_snmp_prop_handler *hnd; - int ret; obj = php_snmp_fetch_object(object); hnd = zend_hash_find_ptr(&php_snmp_properties, name); if (hnd && hnd->read_func) { - ret = hnd->read_func(obj, rv); + zend_result ret = hnd->read_func(obj, rv); if (ret == SUCCESS) { retval = rv; } else {