From 4eedcb476362c7f301dc7f3039d9f1d27f979ce8 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:43 +0000 Subject: [PATCH 01/23] ext/bz2: applied fixers to improve test robustness --- ext/bz2/tests/001.phpt | 20 +++++++++---------- ext/bz2/tests/002.phpt | 8 ++++---- ext/bz2/tests/003-mb.phpt | 4 ++-- ext/bz2/tests/003.phpt | 4 ++-- ext/bz2/tests/004.phpt | 16 +++++++-------- .../bzerr_functions_on_invalid_stream.phpt | 12 +++++------ ...zopen_string_filename_with_null_bytes.phpt | 8 ++++---- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ext/bz2/tests/001.phpt b/ext/bz2/tests/001.phpt index 6323a224c3ac..31a8c1ea8bce 100644 --- a/ext/bz2/tests/001.phpt +++ b/ext/bz2/tests/001.phpt @@ -8,31 +8,31 @@ bz2 try { var_dump(bzopen("", "r")); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(bzopen("", "w")); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(bzopen("no_such_file", "")); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(bzopen("no_such_file", "x")); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(bzopen("no_such_file", "rw")); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(bzopen("no_such_file", "r")); @@ -42,11 +42,11 @@ var_dump(bzopen($fp, "r")); ?> --EXPECTF-- -bzopen(): Argument #1 ($file) must not be empty -bzopen(): Argument #1 ($file) must not be empty -bzopen(): Argument #2 ($mode) must be either "r" or "w" -bzopen(): Argument #2 ($mode) must be either "r" or "w" -bzopen(): Argument #2 ($mode) must be either "r" or "w" +ValueError: bzopen(): Argument #1 ($file) must not be empty +ValueError: bzopen(): Argument #1 ($file) must not be empty +ValueError: bzopen(): Argument #2 ($mode) must be either "r" or "w" +ValueError: bzopen(): Argument #2 ($mode) must be either "r" or "w" +ValueError: bzopen(): Argument #2 ($mode) must be either "r" or "w" Warning: bzopen(): Failed to open stream: No such file or directory in %s on line %d bool(false) diff --git a/ext/bz2/tests/002.phpt b/ext/bz2/tests/002.phpt index 7210f90a4d92..105fa0b4f57e 100644 --- a/ext/bz2/tests/002.phpt +++ b/ext/bz2/tests/002.phpt @@ -31,14 +31,14 @@ $fp = fopen("bz_open_002.txt", "br"); try { var_dump(bzopen($fp, "r")); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $fp = fopen("bz_open_002.txt", "br"); try { var_dump(bzopen($fp, "w")); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $fp = fopen("bz_open_002.txt", "r"); @@ -91,10 +91,10 @@ resource(%d) of type (stream) resource(%d) of type (stream) Warning: fopen(): Failed to open stream: `br' is not a valid mode for fopen in %s on line %d -bzopen(): Argument #1 ($file) must be of type string or file-resource, false given +TypeError: bzopen(): Argument #1 ($file) must be of type string or file-resource, false given Warning: fopen(): Failed to open stream: `br' is not a valid mode for fopen in %s on line %d -bzopen(): Argument #1 ($file) must be of type string or file-resource, false given +TypeError: bzopen(): Argument #1 ($file) must be of type string or file-resource, false given Warning: bzopen(): cannot write to a stream opened in read only mode in %s on line %d bool(false) diff --git a/ext/bz2/tests/003-mb.phpt b/ext/bz2/tests/003-mb.phpt index 3189b473a4ac..805cc150e1ed 100644 --- a/ext/bz2/tests/003-mb.phpt +++ b/ext/bz2/tests/003-mb.phpt @@ -11,7 +11,7 @@ var_dump(bzread($fd, 0)); try { var_dump(bzread($fd, -10)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(bzread($fd, 1)); @@ -21,7 +21,7 @@ var_dump(bzread($fd, 100000)); ?> --EXPECT-- string(0) "" -bzread(): Argument #2 ($length) must be greater than or equal to 0 +ValueError: bzread(): Argument #2 ($length) must be greater than or equal to 0 string(1) "R" string(2) "is" string(251) "ing up from the heart of the desert diff --git a/ext/bz2/tests/003.phpt b/ext/bz2/tests/003.phpt index 4b6ee820dd56..f737422a074c 100644 --- a/ext/bz2/tests/003.phpt +++ b/ext/bz2/tests/003.phpt @@ -11,7 +11,7 @@ var_dump(bzread($fd, 0)); try { var_dump(bzread($fd, -10)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(bzread($fd, 1)); @@ -21,7 +21,7 @@ var_dump(bzread($fd, 100000)); ?> --EXPECT-- string(0) "" -bzread(): Argument #2 ($length) must be greater than or equal to 0 +ValueError: bzread(): Argument #2 ($length) must be greater than or equal to 0 string(1) "R" string(2) "is" string(251) "ing up from the heart of the desert diff --git a/ext/bz2/tests/004.phpt b/ext/bz2/tests/004.phpt index 240cef37a17a..910aa067f6b4 100644 --- a/ext/bz2/tests/004.phpt +++ b/ext/bz2/tests/004.phpt @@ -39,22 +39,22 @@ bzclose($fd2); try { var_dump(bzread($fd2)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bzerror($fd2)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bzerrstr($fd2)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bzerrno($fd2)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; @@ -112,8 +112,8 @@ array(2) { } string(10) "DATA_ERROR" int(-4) -bzread(): Argument #1 ($bz) must be an open stream resource -bzerror(): Argument #1 ($bz) must be an open stream resource -bzerrstr(): Argument #1 ($bz) must be an open stream resource -bzerrno(): Argument #1 ($bz) must be an open stream resource +TypeError: bzread(): Argument #1 ($bz) must be an open stream resource +TypeError: bzerror(): Argument #1 ($bz) must be an open stream resource +TypeError: bzerrstr(): Argument #1 ($bz) must be an open stream resource +TypeError: bzerrno(): Argument #1 ($bz) must be an open stream resource Done diff --git a/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt b/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt index a9fd3a211869..03b8e09c6547 100644 --- a/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt +++ b/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt @@ -8,20 +8,20 @@ $f = fopen(__FILE__, 'r'); try { var_dump(bzerrno($f)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bzerrstr($f)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(bzerror($f)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -bzerrno(): Argument #1 ($bz) must be a bz2 stream -bzerrstr(): Argument #1 ($bz) must be a bz2 stream -bzerror(): Argument #1 ($bz) must be a bz2 stream +TypeError: bzerrno(): Argument #1 ($bz) must be a bz2 stream +TypeError: bzerrstr(): Argument #1 ($bz) must be a bz2 stream +TypeError: bzerror(): Argument #1 ($bz) must be a bz2 stream diff --git a/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt b/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt index b76515a178d9..6f47c2fa237c 100644 --- a/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt +++ b/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt @@ -8,16 +8,16 @@ bz2 try { bzopen("file\0", "w"); } catch (TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { bzopen("file\0", "r"); } catch (TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -bzopen(): Argument #1 ($file) must not contain null bytes -bzopen(): Argument #1 ($file) must not contain null bytes +TypeError: bzopen(): Argument #1 ($file) must not contain null bytes +TypeError: bzopen(): Argument #1 ($file) must not contain null bytes From 78350f14aa35a114c59412eb93ae7d58ce141dab Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:43 +0000 Subject: [PATCH 02/23] ext/calendar: applied fixers to improve test robustness --- ext/calendar/tests/bug80185.phpt | 4 +-- .../tests/cal_days_in_month_error1.phpt | 8 ++--- ext/calendar/tests/cal_from_jd_error1.phpt | 4 +-- ext/calendar/tests/cal_info.phpt | 4 +-- ext/calendar/tests/cal_to_jd_error1.phpt | 4 +-- ext/calendar/tests/easter_date_64bit.phpt | 16 +++++----- .../easter_date_checks_upper_bound_64bit.phpt | 4 +-- ext/calendar/tests/gh16228.phpt | 12 +++---- ext/calendar/tests/gh16231.phpt | 8 ++--- ext/calendar/tests/gh16234_2_64.phpt | 5 ++- ext/calendar/tests/gh19371.phpt | 32 +++++++++---------- ext/calendar/tests/jdtojewish.phpt | 4 +-- ext/calendar/tests/jdtojewish_hebrew.phpt | 1 - ext/calendar/tests/jdtounix_error1.phpt | 4 +-- ext/calendar/tests/unixtojd_error1.phpt | 4 +-- 15 files changed, 56 insertions(+), 58 deletions(-) diff --git a/ext/calendar/tests/bug80185.phpt b/ext/calendar/tests/bug80185.phpt index d52f9696a173..44b9df86ac0c 100644 --- a/ext/calendar/tests/bug80185.phpt +++ b/ext/calendar/tests/bug80185.phpt @@ -13,10 +13,10 @@ var_dump(jdtounix((int)(PHP_INT_MAX / 86400 + 2440588))); try { var_dump(jdtounix((int)(PHP_INT_MAX / 86400 + 2440589))); } catch (ValueError $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } ?> --EXPECT-- int(2170713600) int(9223372036854720000) -jday must be between 2440588 and 106751993607888 +ValueError: jday must be between 2440588 and 106751993607888 diff --git a/ext/calendar/tests/cal_days_in_month_error1.phpt b/ext/calendar/tests/cal_days_in_month_error1.phpt index e110c13cc2a7..dcf7db51ec0b 100644 --- a/ext/calendar/tests/cal_days_in_month_error1.phpt +++ b/ext/calendar/tests/cal_days_in_month_error1.phpt @@ -9,14 +9,14 @@ calendar try { cal_days_in_month(-1, 4, 2017); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try{ cal_days_in_month(CAL_GREGORIAN,20, 2009); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -cal_days_in_month(): Argument #1 ($calendar) must be a valid calendar ID -Invalid date +ValueError: cal_days_in_month(): Argument #1 ($calendar) must be a valid calendar ID +ValueError: Invalid date diff --git a/ext/calendar/tests/cal_from_jd_error1.phpt b/ext/calendar/tests/cal_from_jd_error1.phpt index 3b4e11b8350d..80731b867647 100644 --- a/ext/calendar/tests/cal_from_jd_error1.phpt +++ b/ext/calendar/tests/cal_from_jd_error1.phpt @@ -9,8 +9,8 @@ calendar try { cal_from_jd(1748326, -1); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -cal_from_jd(): Argument #2 ($calendar) must be a valid calendar ID +ValueError: cal_from_jd(): Argument #2 ($calendar) must be a valid calendar ID diff --git a/ext/calendar/tests/cal_info.phpt b/ext/calendar/tests/cal_info.phpt index 18884917e534..1990c1ccbd6d 100644 --- a/ext/calendar/tests/cal_info.phpt +++ b/ext/calendar/tests/cal_info.phpt @@ -11,7 +11,7 @@ calendar try { cal_info(99999); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- @@ -216,4 +216,4 @@ Array [calname] => Julian [calsymbol] => CAL_JULIAN ) -cal_info(): Argument #1 ($calendar) must be a valid calendar ID +ValueError: cal_info(): Argument #1 ($calendar) must be a valid calendar ID diff --git a/ext/calendar/tests/cal_to_jd_error1.phpt b/ext/calendar/tests/cal_to_jd_error1.phpt index 1cef36af69fe..18ab699de1d7 100644 --- a/ext/calendar/tests/cal_to_jd_error1.phpt +++ b/ext/calendar/tests/cal_to_jd_error1.phpt @@ -9,8 +9,8 @@ calendar try { cal_to_jd(-1, 8, 26, 74); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -cal_to_jd(): Argument #1 ($calendar) must be a valid calendar ID +ValueError: cal_to_jd(): Argument #1 ($calendar) must be a valid calendar ID diff --git a/ext/calendar/tests/easter_date_64bit.phpt b/ext/calendar/tests/easter_date_64bit.phpt index 3939b7e4a4d4..f6d97ba9f20f 100644 --- a/ext/calendar/tests/easter_date_64bit.phpt +++ b/ext/calendar/tests/easter_date_64bit.phpt @@ -20,14 +20,14 @@ echo date("Y-m-d", easter_date(2047))."\n"; try { easter_date(1492); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -2000-04-23 -2001-04-15 -2002-03-31 -2045-04-09 -2046-03-25 -2047-04-14 -easter_date(): Argument #1 ($year) must be a year after 1970 (inclusive) +2000-04-23 +2001-04-15 +2002-03-31 +2045-04-09 +2046-03-25 +2047-04-14 +ValueError: easter_date(): Argument #1 ($year) must be a year after 1970 (inclusive) diff --git a/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt b/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt index 2c7afbdfa2d9..c2177673ffee 100644 --- a/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt +++ b/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt @@ -14,8 +14,8 @@ putenv('TZ=UTC'); try { easter_date(293274701009); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -easter_date(): Argument #1 ($year) must be a year before 2.000.000.000 (inclusive) +ValueError: easter_date(): Argument #1 ($year) must be a year before 2.000.000.000 (inclusive) diff --git a/ext/calendar/tests/gh16228.phpt b/ext/calendar/tests/gh16228.phpt index 9ce80688195b..0699152566fe 100644 --- a/ext/calendar/tests/gh16228.phpt +++ b/ext/calendar/tests/gh16228.phpt @@ -7,20 +7,20 @@ calendar try { easter_days(PHP_INT_MAX, 0); } catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { easter_days(-1, 0); } catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { easter_date(PHP_INT_MAX, 0); } catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -easter_days(): Argument #1 ($year) must be between 1 and %d -easter_days(): Argument #1 ($year) must be between 1 and %d -easter_date(): Argument #1 ($year) must be between 1 and %d +ValueError: easter_days(): Argument #1 ($year) must be between 1 and %d +ValueError: easter_days(): Argument #1 ($year) must be between 1 and %d +ValueError: easter_date(): Argument #1 ($year) must be between 1 and %d diff --git a/ext/calendar/tests/gh16231.phpt b/ext/calendar/tests/gh16231.phpt index 89b09dd3f63a..d003f38b1f06 100644 --- a/ext/calendar/tests/gh16231.phpt +++ b/ext/calendar/tests/gh16231.phpt @@ -7,15 +7,15 @@ calendar try { jdtounix(PHP_INT_MIN); } catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { jdtounix(240587); } catch (\ValueError $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -jday must be between 2440588 and %d -jday must be between 2440588 and %d +ValueError: jday must be between 2440588 and %d +ValueError: jday must be between 2440588 and %d diff --git a/ext/calendar/tests/gh16234_2_64.phpt b/ext/calendar/tests/gh16234_2_64.phpt index 7da254609650..166e67a0efaf 100644 --- a/ext/calendar/tests/gh16234_2_64.phpt +++ b/ext/calendar/tests/gh16234_2_64.phpt @@ -13,9 +13,8 @@ if (PHP_INT_SIZE == 4) { try { jewishtojd(10, 6, PHP_INT_MIN); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -jewishtojd(): Argument #3 ($year) must be between %i and %d - +ValueError: jewishtojd(): Argument #3 ($year) must be between %i and %d diff --git a/ext/calendar/tests/gh19371.phpt b/ext/calendar/tests/gh19371.phpt index 1d807a983886..b2b4837851cb 100644 --- a/ext/calendar/tests/gh19371.phpt +++ b/ext/calendar/tests/gh19371.phpt @@ -10,52 +10,52 @@ calendar try { echo cal_days_in_month(CAL_GREGORIAN, 12, PHP_INT_MAX); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_days_in_month(CAL_GREGORIAN, PHP_INT_MIN, 1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_days_in_month(CAL_GREGORIAN, PHP_INT_MAX, 1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_to_jd(CAL_GREGORIAN, PHP_INT_MIN, 1, 1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_to_jd(CAL_GREGORIAN, PHP_INT_MAX, 1, 1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_to_jd(CAL_GREGORIAN, 1, PHP_INT_MIN, 1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_to_jd(CAL_GREGORIAN, 1, PHP_INT_MAX, 1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { echo cal_to_jd(CAL_GREGORIAN, 1, 1, PHP_INT_MAX); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -cal_days_in_month(): Argument #3 ($year) must be less than 2147483646 -cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646 -cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646 -cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646 -cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646 -cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647 -cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647 -cal_to_jd(): Argument #4 ($year) must be less than 2147483646 +ValueError: cal_days_in_month(): Argument #3 ($year) must be less than 2147483646 +ValueError: cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646 +ValueError: cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646 +ValueError: cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646 +ValueError: cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646 +ValueError: cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647 +ValueError: cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647 +ValueError: cal_to_jd(): Argument #4 ($year) must be less than 2147483646 diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt index 6b1c2e3f7756..ba40a2056da5 100644 --- a/ext/calendar/tests/jdtojewish.phpt +++ b/ext/calendar/tests/jdtojewish.phpt @@ -23,7 +23,7 @@ echo jdtojewish(gregoriantojd(1,1,9998)) . "\n"; try { jdtojewish(gregoriantojd(1,1,9998),true); } catch (ValueError $ex) { - echo "{$ex->getMessage()}\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECTF-- @@ -42,4 +42,4 @@ string(%d) "2/22/5763 2/30/5763 3/16/5765 3/8/13758 -Year out of range (0-9999) +ValueError: Year out of range (0-9999) diff --git a/ext/calendar/tests/jdtojewish_hebrew.phpt b/ext/calendar/tests/jdtojewish_hebrew.phpt index ceb53c219e71..3909162e1bf4 100644 --- a/ext/calendar/tests/jdtojewish_hebrew.phpt +++ b/ext/calendar/tests/jdtojewish_hebrew.phpt @@ -46,4 +46,3 @@ e020f1e9e5ef20e4e0 e020faeee5e620e4e0 e020e0e120e4e0 e020e0ece5ec20e4e0 - diff --git a/ext/calendar/tests/jdtounix_error1.phpt b/ext/calendar/tests/jdtounix_error1.phpt index 0032e376db3c..adad98947dcd 100644 --- a/ext/calendar/tests/jdtounix_error1.phpt +++ b/ext/calendar/tests/jdtounix_error1.phpt @@ -11,8 +11,8 @@ calendar try { jdtounix(2440579); } catch (ValueError $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } ?> --EXPECTF-- -jday must be between 2440588 and %d +ValueError: jday must be between 2440588 and %d diff --git a/ext/calendar/tests/unixtojd_error1.phpt b/ext/calendar/tests/unixtojd_error1.phpt index 171d400b99e7..a17a5b291a05 100644 --- a/ext/calendar/tests/unixtojd_error1.phpt +++ b/ext/calendar/tests/unixtojd_error1.phpt @@ -13,12 +13,12 @@ putenv('TZ=UTC'); try { unixtojd(-1); } catch (ValueError $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } var_dump(unixtojd(null)) . PHP_EOL; var_dump(unixtojd(time())) . PHP_EOL; ?> --EXPECTF-- -unixtojd(): Argument #1 ($timestamp) must be greater than or equal to 0 +ValueError: unixtojd(): Argument #1 ($timestamp) must be greater than or equal to 0 int(%d) int(%d) From bf7c67d6dc75a67cf078eef2a6c9129984b99d74 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:44 +0000 Subject: [PATCH 03/23] ext/exif: applied fixers to improve test robustness --- ext/exif/tests/bug77540.phpt | 2 +- ext/exif/tests/bug77831.phpt | 2 +- ext/exif/tests/bug77950.phpt | 2 +- ext/exif/tests/filename_empty.phpt | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/exif/tests/bug77540.phpt b/ext/exif/tests/bug77540.phpt index 397e9f8223ba..92a5927068fd 100644 --- a/ext/exif/tests/bug77540.phpt +++ b/ext/exif/tests/bug77540.phpt @@ -13,4 +13,4 @@ DONE --EXPECT-- Width 0 Height 0 -DONE \ No newline at end of file +DONE diff --git a/ext/exif/tests/bug77831.phpt b/ext/exif/tests/bug77831.phpt index 5f29581d11ce..1490b2d66064 100644 --- a/ext/exif/tests/bug77831.phpt +++ b/ext/exif/tests/bug77831.phpt @@ -10,4 +10,4 @@ DONE --EXPECTF-- %A bool(false) -DONE \ No newline at end of file +DONE diff --git a/ext/exif/tests/bug77950.phpt b/ext/exif/tests/bug77950.phpt index bccd9ec3e2c3..7361ff596a61 100644 --- a/ext/exif/tests/bug77950.phpt +++ b/ext/exif/tests/bug77950.phpt @@ -9,4 +9,4 @@ exif_read_data(__DIR__."/bug77950.tiff"); DONE --EXPECTF-- %A -DONE \ No newline at end of file +DONE diff --git a/ext/exif/tests/filename_empty.phpt b/ext/exif/tests/filename_empty.phpt index 753a7c6acd09..89b16cda0afa 100644 --- a/ext/exif/tests/filename_empty.phpt +++ b/ext/exif/tests/filename_empty.phpt @@ -8,30 +8,30 @@ exif try { exif_read_data(""); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { exif_thumbnail(""); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { exif_read_data("foo\0bar"); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { exif_thumbnail("foo\0bar"); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -exif_read_data(): Argument #1 ($file) must not be empty -exif_thumbnail(): Argument #1 ($file) must not be empty -exif_read_data(): Argument #1 ($file) must not contain any null bytes -exif_thumbnail(): Argument #1 ($file) must not contain any null bytes +ValueError: exif_read_data(): Argument #1 ($file) must not be empty +ValueError: exif_thumbnail(): Argument #1 ($file) must not be empty +ValueError: exif_read_data(): Argument #1 ($file) must not contain any null bytes +ValueError: exif_thumbnail(): Argument #1 ($file) must not contain any null bytes From fc9a27f2ab4491bdd0ecf93b63ae0134d2b48437 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:44 +0000 Subject: [PATCH 04/23] ext/fileinfo: applied fixers to improve test robustness --- ext/fileinfo/tests/bug61173.phpt | 4 ++-- ext/fileinfo/tests/clone_serialize.phpt | 8 +++---- ext/fileinfo/tests/finfo_close_error.phpt | 4 ++-- ext/fileinfo/tests/finfo_file_001.phpt | 8 +++---- ext/fileinfo/tests/finfo_file_basic.phpt | 4 ++-- ext/fileinfo/tests/finfo_open_001.phpt | 16 ++++++------- ext/fileinfo/tests/finfo_open_003.phpt | 4 ++-- ext/fileinfo/tests/finfo_open_004.phpt | 4 ++-- ext/fileinfo/tests/finfo_open_error.phpt | 8 +++---- ext/fileinfo/tests/finfo_uninitialized.phpt | 12 +++++----- ext/fileinfo/tests/gh18267.phpt | 4 ++-- ext/fileinfo/tests/mime_content_type_001.phpt | 24 +++++++++---------- 12 files changed, 50 insertions(+), 50 deletions(-) diff --git a/ext/fileinfo/tests/bug61173.phpt b/ext/fileinfo/tests/bug61173.phpt index e135f9093339..9d18dc8bcf52 100644 --- a/ext/fileinfo/tests/bug61173.phpt +++ b/ext/fileinfo/tests/bug61173.phpt @@ -9,8 +9,8 @@ try { $finfo = new finfo(1, '', false); var_dump($finfo); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -finfo::__construct() expects at most 2 arguments, 3 given +ArgumentCountError: finfo::__construct() expects at most 2 arguments, 3 given diff --git a/ext/fileinfo/tests/clone_serialize.phpt b/ext/fileinfo/tests/clone_serialize.phpt index 768cccfff392..7a63d04908a1 100644 --- a/ext/fileinfo/tests/clone_serialize.phpt +++ b/ext/fileinfo/tests/clone_serialize.phpt @@ -11,17 +11,17 @@ try { $finfo2 = clone $finfo; var_dump($finfo2->buffer("Test string")); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $finfo3 = unserialize(serialize($finfo)); var_dump($finfo3->buffer("Test string")); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- string(%d) "%s" -Trying to clone an uncloneable object of class finfo -Serialization of 'finfo' is not allowed +Error: Trying to clone an uncloneable object of class finfo +Exception: Serialization of 'finfo' is not allowed diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt index c7873b462724..798adb7e4dab 100644 --- a/ext/fileinfo/tests/finfo_close_error.phpt +++ b/ext/fileinfo/tests/finfo_close_error.phpt @@ -11,7 +11,7 @@ $fp = fopen( __FILE__, 'r' ); try { var_dump( finfo_close( $fp ) ); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -21,4 +21,4 @@ try { -- Testing finfo_close() function with wrong resource type -- Deprecated: Function finfo_close() is deprecated since 8.5, as finfo objects are freed automatically in %s on line %d -finfo_close(): Argument #1 ($finfo) must be of type finfo, resource given +TypeError: finfo_close(): Argument #1 ($finfo) must be of type finfo, resource given diff --git a/ext/fileinfo/tests/finfo_file_001.phpt b/ext/fileinfo/tests/finfo_file_001.phpt index 91b9b69717f6..184eee77633a 100644 --- a/ext/fileinfo/tests/finfo_file_001.phpt +++ b/ext/fileinfo/tests/finfo_file_001.phpt @@ -9,20 +9,20 @@ $fp = finfo_open(); try { var_dump(finfo_file($fp, "\0")); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(finfo_file($fp, '')); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(finfo_file($fp, '.')); var_dump(finfo_file($fp, '&')); ?> --EXPECTF-- -finfo_file(): Argument #2 ($filename) must not contain any null bytes -finfo_file(): Argument #2 ($filename) must not be empty +ValueError: finfo_file(): Argument #2 ($filename) must not contain any null bytes +ValueError: finfo_file(): Argument #2 ($filename) must not be empty string(9) "directory" Warning: finfo_file(): Failed to open stream: No such file or directory in %s on line %d diff --git a/ext/fileinfo/tests/finfo_file_basic.phpt b/ext/fileinfo/tests/finfo_file_basic.phpt index 4545a3063a7f..9348dea33075 100644 --- a/ext/fileinfo/tests/finfo_file_basic.phpt +++ b/ext/fileinfo/tests/finfo_file_basic.phpt @@ -16,7 +16,7 @@ var_dump( finfo_file( $finfo, $magicFile ) ); try { var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) ); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> @@ -25,4 +25,4 @@ try { string(28) "text/x-php; charset=us-ascii" string(22) "PHP script, ASCII text" string(29) "text/x-file; charset=us-ascii" -finfo_file(): Argument #2 ($filename) must not contain any null bytes +ValueError: finfo_file(): Argument #2 ($filename) must not contain any null bytes diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index 2ed7168e90d3..2ee999113b95 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -7,7 +7,7 @@ fileinfo try { var_dump(finfo_open(FILEINFO_MIME, "\0")); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(finfo_open(FILEINFO_MIME, NULL)); @@ -22,23 +22,23 @@ var_dump($obj = new finfo(FILEINFO_MIME, '')); try { var_dump($obj = new finfo(FILEINFO_MIME, 123)); } catch (\Exception $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($obj = new finfo(FILEINFO_MIME, 1.0)); } catch (\Exception $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($obj = new finfo(FILEINFO_MIME, '/foo/bar/inexistent')); } catch (\Exception $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -finfo_open(): Argument #2 ($magic_database) must not contain any null bytes +ValueError: finfo_open(): Argument #2 ($magic_database) must not contain any null bytes object(finfo)#%d (0) { } object(finfo)#%d (0) { @@ -68,6 +68,6 @@ object(finfo)#%d (%d) { } object(finfo)#%d (%d) { } -finfo::__construct(): Failed to open stream: No such file or directory -finfo::__construct(): Failed to open stream: No such file or directory -finfo::__construct(): Failed to open stream: No such file or directory +Exception: finfo::__construct(): Failed to open stream: No such file or directory +Exception: finfo::__construct(): Failed to open stream: No such file or directory +Exception: finfo::__construct(): Failed to open stream: No such file or directory diff --git a/ext/fileinfo/tests/finfo_open_003.phpt b/ext/fileinfo/tests/finfo_open_003.phpt index 39a45a61c6ff..7e464c3d39c2 100644 --- a/ext/fileinfo/tests/finfo_open_003.phpt +++ b/ext/fileinfo/tests/finfo_open_003.phpt @@ -11,9 +11,9 @@ var_dump(finfo_open(FILEINFO_MIME, $buggyPath)); try { $object = new finfo(FILEINFO_MIME, $buggyPath); } catch (\Exception $ex) { - echo "TEST:" . $ex->getMessage() . PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } ?> --EXPECTF-- bool(false) -TEST:Constructor failed +Exception: Constructor failed diff --git a/ext/fileinfo/tests/finfo_open_004.phpt b/ext/fileinfo/tests/finfo_open_004.phpt index ff911bc75086..06f7858cb24d 100644 --- a/ext/fileinfo/tests/finfo_open_004.phpt +++ b/ext/fileinfo/tests/finfo_open_004.phpt @@ -13,10 +13,10 @@ var_dump(finfo_open(FILEINFO_MIME, $buggyPath)); try { $object = new finfo(FILEINFO_MIME, $buggyPath); } catch (\Exception $ex) { - echo "TEST:" . $ex->getMessage() . PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } ?> --EXPECTF-- Warning: finfo_open(): File name is longer than the maximum allowed path length on this platform (%d): %s in %s on line %d bool(false) -TEST:finfo::__construct(): File name is longer than the maximum allowed path length on this platform (%d): %s +Exception: finfo::__construct(): File name is longer than the maximum allowed path length on this platform (%d): %s diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt index 7c6fc9766372..c48230b7aa2f 100644 --- a/ext/fileinfo/tests/finfo_open_error.phpt +++ b/ext/fileinfo/tests/finfo_open_error.phpt @@ -14,13 +14,13 @@ var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) ); try { var_dump( finfo_open( 'foobar' ) ); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump( new finfo('foobar') ); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -37,5 +37,5 @@ bool(false) Warning: finfo_open(): using regular magic file `%smagic' in %sfinfo_open_error.php on line %d object(finfo)#%d (0) { } -finfo_open(): Argument #1 ($flags) must be of type int, string given -finfo::__construct(): Argument #1 ($flags) must be of type int, string given +TypeError: finfo_open(): Argument #1 ($flags) must be of type int, string given +TypeError: finfo::__construct(): Argument #1 ($flags) must be of type int, string given diff --git a/ext/fileinfo/tests/finfo_uninitialized.phpt b/ext/fileinfo/tests/finfo_uninitialized.phpt index 533574c9c0dc..9aba6719414c 100644 --- a/ext/fileinfo/tests/finfo_uninitialized.phpt +++ b/ext/fileinfo/tests/finfo_uninitialized.phpt @@ -10,37 +10,37 @@ $finfo = (new ReflectionClass('finfo'))->newInstanceWithoutConstructor(); try { var_dump(finfo_set_flags($finfo, FILEINFO_NONE)); } catch (Error $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($finfo->set_flags(FILEINFO_NONE)); } catch (Error $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(finfo_file($finfo, __FILE__)); } catch (Error $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($finfo->file(__FILE__)); } catch (Error $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(finfo_buffer($finfo, file_get_contents(__FILE__))); } catch (Error $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($finfo->file(file_get_contents(__FILE__))); } catch (Error $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> diff --git a/ext/fileinfo/tests/gh18267.phpt b/ext/fileinfo/tests/gh18267.phpt index ba7647288d1d..a33a51775a80 100644 --- a/ext/fileinfo/tests/gh18267.phpt +++ b/ext/fileinfo/tests/gh18267.phpt @@ -8,7 +8,7 @@ $cls = new finfo(); try { $cls->file("test",FILEINFO_NONE, STDERR); } catch (\TypeError $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } --EXPECT-- -finfo::file(): supplied resource is not a valid Stream-Context resource +TypeError: finfo::file(): supplied resource is not a valid Stream-Context resource diff --git a/ext/fileinfo/tests/mime_content_type_001.phpt b/ext/fileinfo/tests/mime_content_type_001.phpt index 93b145768141..74e22de59aa0 100644 --- a/ext/fileinfo/tests/mime_content_type_001.phpt +++ b/ext/fileinfo/tests/mime_content_type_001.phpt @@ -8,22 +8,22 @@ fileinfo try { mime_content_type(1); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { mime_content_type(NULL); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { mime_content_type(new stdclass); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { mime_content_type(array()); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } mime_content_type('foo/inexistent'); @@ -31,21 +31,21 @@ mime_content_type('foo/inexistent'); try { mime_content_type(''); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { mime_content_type("\0"); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -mime_content_type(): Argument #1 ($filename) must be of type resource|string, int given -mime_content_type(): Argument #1 ($filename) must be of type resource|string, null given -mime_content_type(): Argument #1 ($filename) must be of type resource|string, stdClass given -mime_content_type(): Argument #1 ($filename) must be of type resource|string, array given +TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, int given +TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, null given +TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, stdClass given +TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, array given Warning: mime_content_type(): Failed to open stream: No such file or directory in %s on line %d -mime_content_type(): Argument #1 ($filename) must not be empty -mime_content_type(): Argument #1 ($filename) must not contain any null bytes +ValueError: mime_content_type(): Argument #1 ($filename) must not be empty +TypeError: mime_content_type(): Argument #1 ($filename) must not contain any null bytes From de99a06f1319a3df68cc8bc4c0e0956743ba0994 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:44 +0000 Subject: [PATCH 05/23] ext/filter: applied fixers to improve test robustness --- ext/filter/tests/011.phpt | 4 +-- ext/filter/tests/017.phpt | 4 +-- ext/filter/tests/029.phpt | 16 +++++------ ext/filter/tests/031.phpt | 4 +-- ext/filter/tests/039.phpt | 28 +++++++++---------- ext/filter/tests/040.phpt | 4 +-- ext/filter/tests/055.phpt | 6 ++-- ext/filter/tests/bug51368.phpt | 4 +-- .../filter_input_array_failure.phpt | 4 +-- .../filter_input_failure.phpt | 6 ++-- .../filter_var_array_failure.phpt | 6 ++-- .../throw-on-failure/filter_var_failure.phpt | 6 ++-- .../throw-and-null-error.phpt | 18 ++++++------ 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/ext/filter/tests/011.phpt b/ext/filter/tests/011.phpt index 772fdf6b5ec7..008967099f7d 100644 --- a/ext/filter/tests/011.phpt +++ b/ext/filter/tests/011.phpt @@ -16,7 +16,7 @@ var_dump(filter_input(INPUT_GET, "a", FILTER_SANITIZE_SPECIAL_CHARS, array(1,2,3 try { filter_input(INPUT_GET, "b", FILTER_VALIDATE_FLOAT, new stdClass); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT)); var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS)); @@ -27,7 +27,7 @@ echo "Done\n"; --EXPECT-- string(18) "http://example.com" string(27) "<b>test</b>" -filter_input(): Argument #4 ($options) must be of type array|int, stdClass given +TypeError: filter_input(): Argument #4 ($options) must be of type array|int, stdClass given float(12345.7) string(29) "<p>string</p>" bool(false) diff --git a/ext/filter/tests/017.phpt b/ext/filter/tests/017.phpt index e37177c60d6e..9d2e702b4c7f 100644 --- a/ext/filter/tests/017.phpt +++ b/ext/filter/tests/017.phpt @@ -13,7 +13,7 @@ var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("rege try { filter_var("data", FILTER_VALIDATE_REGEXP); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; @@ -24,5 +24,5 @@ bool(false) string(4) "data" bool(false) bool(false) -filter_var(): "regexp" option is missing +ValueError: filter_var(): "regexp" option is missing Done diff --git a/ext/filter/tests/029.phpt b/ext/filter/tests/029.phpt index ca4feb2e4ae0..44415e06b090 100644 --- a/ext/filter/tests/029.phpt +++ b/ext/filter/tests/029.phpt @@ -17,19 +17,19 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test"))); try { filter_var("qwe", FILTER_CALLBACK, array("options"=>"no such func")); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { filter_var("qwe", FILTER_CALLBACK, array("options"=>"")); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { filter_var("qwe", FILTER_CALLBACK); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } /* Simple class method callback */ @@ -68,7 +68,7 @@ function test3($var) { try { var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3"))); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; @@ -77,9 +77,9 @@ echo "Done\n"; string(4) "DATA" string(46) "~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?"}{:" string(0) "" -filter_var(): Option must be a valid callback -filter_var(): Option must be a valid callback -filter_var(): Option must be a valid callback +TypeError: filter_var(): Option must be a valid callback +TypeError: filter_var(): Option must be a valid callback +TypeError: filter_var(): Option must be a valid callback string(4) "data" string(46) "~!@#$%^&*()_qwertyuiopasdfghjklzxcvbnm<>>?"}{:" string(0) "" @@ -95,5 +95,5 @@ NULL Warning: test2(): Argument #1 ($var) must be passed by reference, value given in %s on line %d NULL -string(4) "test" +Exception: test Done diff --git a/ext/filter/tests/031.phpt b/ext/filter/tests/031.phpt index 70117fa025ad..eb930642d18f 100644 --- a/ext/filter/tests/031.phpt +++ b/ext/filter/tests/031.phpt @@ -36,7 +36,7 @@ foreach ($floats as $float => $dec) { try { var_dump(filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec)))); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } @@ -55,5 +55,5 @@ custom decimal: bool(false) float(1.234) float(1.234) -filter_var(): "decimal" option must be one character long +ValueError: filter_var(): "decimal" option must be one character long bool(false) diff --git a/ext/filter/tests/039.phpt b/ext/filter/tests/039.phpt index 229feecd4475..22a7170c05dd 100644 --- a/ext/filter/tests/039.phpt +++ b/ext/filter/tests/039.phpt @@ -14,7 +14,7 @@ var_dump(filter_var_array(array(), 1000000)); try { filter_var_array(array(), ""); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "-- (2)\n"; @@ -24,7 +24,7 @@ var_dump(filter_var_array(array(""=>""), 1000000)); try { filter_var_array(array(""=>""), ""); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "-- (3)\n"; @@ -34,7 +34,7 @@ var_dump(filter_var_array(array("aaa"=>"bbb"), 1000000)); try { filter_var_array(array("aaa"=>"bbb"), ""); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "-- (4)\n"; @@ -42,7 +42,7 @@ echo "-- (4)\n"; try { filter_var_array(array(), new stdclass); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(filter_var_array(array(), array())); @@ -54,12 +54,12 @@ echo "-- (5)\n"; try { filter_var_array(array("var_name"=>""), array("var_name"=>-1, "asdas"=>"asdasd", "qwe"=>"rty", ""=>"")); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { filter_var_array(array("asdas"=>"text"), array("var_name"=>-1, "asdas"=>"asdasd", "qwe"=>"rty", ""=>"")); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $a = array(""=>""); $b = -1; @@ -74,7 +74,7 @@ $a = array(""=>""); $b = ""; try { filter_var_array($a, $b); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump($a, $b); @@ -96,7 +96,7 @@ bool(false) Warning: filter_var_array(): Unknown filter with ID 1000000 in %s on line %d bool(false) -filter_var_array(): Argument #2 ($options) must be of type array|int, string given +TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given -- (2) Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d @@ -104,7 +104,7 @@ bool(false) Warning: filter_var_array(): Unknown filter with ID 1000000 in %s on line %d bool(false) -filter_var_array(): Argument #2 ($options) must be of type array|int, string given +TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given -- (3) Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d @@ -112,9 +112,9 @@ bool(false) Warning: filter_var_array(): Unknown filter with ID 1000000 in %s on line %d bool(false) -filter_var_array(): Argument #2 ($options) must be of type array|int, string given +TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given -- (4) -filter_var_array(): Argument #2 ($options) must be of type array|int, stdClass given +TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, stdClass given array(0) { } array(1) { @@ -134,10 +134,10 @@ array(1) { -- (5) Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d -filter_var_array(): Argument #2 ($options) cannot contain empty keys +ValueError: filter_var_array(): Argument #2 ($options) cannot contain empty keys Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d -filter_var_array(): Argument #2 ($options) cannot contain empty keys +ValueError: filter_var_array(): Argument #2 ($options) cannot contain empty keys Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d bool(false) @@ -154,7 +154,7 @@ array(1) { string(0) "" } int(100000) -filter_var_array(): Argument #2 ($options) must be of type array|int, string given +TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given array(1) { [""]=> string(0) "" diff --git a/ext/filter/tests/040.phpt b/ext/filter/tests/040.phpt index 316088ff31cd..ff4eedf63b63 100644 --- a/ext/filter/tests/040.phpt +++ b/ext/filter/tests/040.phpt @@ -19,7 +19,7 @@ var_dump(filter_has_var(INPUT_GET, "cc")); try { filter_has_var(-1, "cc"); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(filter_has_var(0, "cc")); @@ -34,6 +34,6 @@ bool(true) bool(true) bool(false) bool(false) -filter_has_var(): Argument #1 ($input_type) must be an INPUT_* constant +ValueError: filter_has_var(): Argument #1 ($input_type) must be an INPUT_* constant bool(false) Done diff --git a/ext/filter/tests/055.phpt b/ext/filter/tests/055.phpt index f058db064b02..23241b76ae90 100644 --- a/ext/filter/tests/055.phpt +++ b/ext/filter/tests/055.phpt @@ -24,7 +24,7 @@ foreach ($values as $value) { try { var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1])); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } @@ -43,6 +43,6 @@ string(17) "01:23:45:67:89:aB" bool(false) bool(false) string(14) "0123.4567.89ab" -filter_var(): "separator" option must be one character long -filter_var(): "separator" option must be one character long +ValueError: filter_var(): "separator" option must be one character long +ValueError: filter_var(): "separator" option must be one character long Done diff --git a/ext/filter/tests/bug51368.phpt b/ext/filter/tests/bug51368.phpt index a3490215afdc..c13866932108 100644 --- a/ext/filter/tests/bug51368.phpt +++ b/ext/filter/tests/bug51368.phpt @@ -14,11 +14,11 @@ $options = ['flags' => FILTER_FLAG_ALLOW_THOUSAND, 'options' => ['thousand' => ' try { filter_var('12345', FILTER_VALIDATE_FLOAT, $options); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- float(1000) float(1234.567) -filter_var(): "thousand" option must not be empty +ValueError: filter_var(): "thousand" option must not be empty diff --git a/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt b/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt index 868829dbbac0..db857f0fef04 100644 --- a/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt +++ b/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt @@ -11,14 +11,14 @@ echo "\nvalidation fails (array type check)\n"; try { filter_input_array(INPUT_GET, ['a' => ['flags' => FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE]]); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (filter value)\n"; try { filter_input_array(INPUT_GET, ['a' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_THROW_ON_FAILURE]]); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/filter/tests/throw-on-failure/filter_input_failure.phpt b/ext/filter/tests/throw-on-failure/filter_input_failure.phpt index 8ec2d572e7f1..7130a777960b 100644 --- a/ext/filter/tests/throw-on-failure/filter_input_failure.phpt +++ b/ext/filter/tests/throw-on-failure/filter_input_failure.phpt @@ -11,21 +11,21 @@ echo "missing value\n"; try { filter_input(INPUT_GET, 'b', FILTER_DEFAULT, FILTER_THROW_ON_FAILURE); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (array type check)\n"; try { filter_input(INPUT_GET, 'a', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (filter value)\n"; try { filter_input(INPUT_GET, 'a', FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt b/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt index f40dec1537dd..36d1db4eaa1a 100644 --- a/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt +++ b/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt @@ -9,21 +9,21 @@ echo "\nvalidation fails (array type check)\n"; try { filter_var_array(['a' => 'a'], ['a' => ['flags' => FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE]]); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (object without __toString)\n"; try { filter_var_array(['a' => new stdClass()], ['a' => ['flags' => FILTER_THROW_ON_FAILURE]]); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (filter value)\n"; try { filter_var_array(['a' => true], ['a' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_THROW_ON_FAILURE]]); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/filter/tests/throw-on-failure/filter_var_failure.phpt b/ext/filter/tests/throw-on-failure/filter_var_failure.phpt index fccc61da4d0f..d7a53105200c 100644 --- a/ext/filter/tests/throw-on-failure/filter_var_failure.phpt +++ b/ext/filter/tests/throw-on-failure/filter_var_failure.phpt @@ -9,21 +9,21 @@ echo "\nvalidation fails (array type check)\n"; try { filter_var('a', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (object without __toString)\n"; try { filter_var(new stdClass(), FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nvalidation fails (filter value)\n"; try { filter_var('a', FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE); } catch (Filter\FilterFailedException $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt b/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt index 48c37618ed91..3dff1a85f788 100644 --- a/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt +++ b/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt @@ -13,54 +13,54 @@ echo "filter_input(), with a missing value\n"; try { filter_input(INPUT_GET, 'b', FILTER_DEFAULT, $flags); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { filter_input(INPUT_GET, 'b', FILTER_DEFAULT, ['flags' => $flags]); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nfilter_input(), with a missing value and a default\n"; try { filter_input(INPUT_GET, 'b', FILTER_DEFAULT, ['flags' => $flags, 'options' => ['default' => 'a']]); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nfilter_input(), with a present value\n"; try { filter_input(INPUT_GET, 'a', FILTER_DEFAULT, $flags); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { filter_input(INPUT_GET, 'a', FILTER_DEFAULT, ['flags' => $flags]); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nfilter_var()\n"; try { filter_var(true, FILTER_DEFAULT, $flags); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { filter_var(true, FILTER_DEFAULT, ['flags' => $flags]); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nfilter_input_array()\n"; try { filter_input_array(INPUT_GET, ['a' => ['flags' => $flags]]); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nfilter_var_array()\n"; try { filter_var_array(['a' => true], ['a' => ['flags' => $flags]]); } catch (ValueError $e) { - echo get_class($e) . ": " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- From 72456d5060a0cb9289599002196e0b724d86c425 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:44 +0000 Subject: [PATCH 06/23] ext/ftp: applied fixers to improve test robustness --- ext/ftp/tests/004.phpt | 4 +- ext/ftp/tests/005.phpt | 20 +-- ext/ftp/tests/007.phpt | 132 +++++++++--------- ext/ftp/tests/dead-resource.phpt | 4 +- ext/ftp/tests/ftp_close_during_transfer.phpt | 4 +- ext/ftp/tests/ftp_constructor.phpt | 4 +- ext/ftp/tests/ftp_get_option.phpt | 4 +- .../tests/ftp_nb_close_during_transfer.phpt | 4 +- ext/ftp/tests/ftp_set_option_errors.phpt | 12 +- ext/ftp/tests/ftp_ssl_connect_error.phpt | 4 +- ext/ftp/tests/gh20601.phpt | 4 +- ext/ftp/tests/gh20601_set_option.phpt | 4 +- ext/ftp/tests/gh20601_ssl.phpt | 4 +- 13 files changed, 102 insertions(+), 102 deletions(-) diff --git a/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt index fde0b5090399..131fe984a1d9 100644 --- a/ext/ftp/tests/004.phpt +++ b/ext/ftp/tests/004.phpt @@ -11,7 +11,7 @@ require 'server.inc'; try { ftp_connect('127.0.0.1', 0, -3); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $ftp = ftp_connect('127.0.0.1', $port); @@ -23,7 +23,7 @@ var_dump(ftp_login($ftp, 'user', 'bogus')); var_dump(ftp_quit($ftp)); ?> --EXPECTF-- -ftp_connect(): Argument #3 ($timeout) must be greater than 0 +ValueError: ftp_connect(): Argument #3 ($timeout) must be greater than 0 bool(true) Warning: ftp_login(): Not logged in. in %s on line %d diff --git a/ext/ftp/tests/005.phpt b/ext/ftp/tests/005.phpt index f08cadd2b428..632badc9c59a 100644 --- a/ext/ftp/tests/005.phpt +++ b/ext/ftp/tests/005.phpt @@ -22,19 +22,19 @@ var_dump(ftp_exec($ftp, 'x')); try { ftp_fget($ftp, STDOUT, 'x', 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { ftp_fput($ftp, 'x', fopen(__FILE__, 'r'), 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { ftp_get($ftp, 'x', 'y', 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(ftp_mdtm($ftp, 'x')); @@ -44,13 +44,13 @@ var_dump(ftp_nb_continue($ftp)); try { ftp_nb_fget($ftp, STDOUT, 'x', 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { ftp_nb_fput($ftp, 'x', fopen(__FILE__, 'r'), 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(ftp_systype($ftp)); @@ -77,9 +77,9 @@ bool(false) Warning: ftp_exec(): Command not implemented (5). in %s005.php on line %d bool(false) -ftp_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY -ftp_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY -ftp_get(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY +ValueError: ftp_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY +ValueError: ftp_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY +ValueError: ftp_get(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY int(-1) Warning: ftp_mkdir(): Command not implemented (7). in %s005.php on line %d @@ -87,8 +87,8 @@ bool(false) Warning: ftp_nb_continue(): No non-blocking transfer to continue in %s on line %d int(0) -ftp_nb_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY -ftp_nb_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY +ValueError: ftp_nb_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY +ValueError: ftp_nb_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY Warning: ftp_systype(): Command not implemented (8). in %s005.php on line %d bool(false) diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt index a23b5496be91..38eb20badd7f 100644 --- a/ext/ftp/tests/007.phpt +++ b/ext/ftp/tests/007.phpt @@ -13,202 +13,202 @@ $ftp = tmpfile(); try { var_dump(ftp_login($ftp, 'user', 'pass')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_pwd($ftp)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_cdup($ftp)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_chdir($ftp, '~')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_exec($ftp, 'x')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_raw($ftp, 'x')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_mkdir($ftp, '/')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_rmdir($ftp, '/')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_chmod($ftp, 7777, '/')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_alloc($ftp, 7777)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_nlist($ftp, '/')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_rawlist($ftp, '~')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_mlsd($ftp, '~')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_systype($ftp)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_fget($ftp, $ftp, 'remote', 7777)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_pasv($ftp, false)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_get($ftp, 'local', 'remote', 7777)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_nb_continue($ftp)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_fput($ftp, 'remote', $ftp, 9999)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_put($ftp, 'remote', 'local', 9999)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_append($ftp, 'remote', 'local', 9999)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_size($ftp, '~')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_mdtm($ftp, '~')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_rename($ftp, 'old', 'new')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_delete($ftp, 'gone')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_site($ftp, 'localhost')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_close($ftp)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_set_option($ftp, 1, 2)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(ftp_get_option($ftp, 1)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } fclose($ftp); ?> --EXPECT-- -ftp_login(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_pwd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_cdup(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_chdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_exec(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_raw(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_mkdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_rmdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_chmod(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_alloc(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_rawlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_mlsd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_systype(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_nb_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_pasv(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_nb_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_nb_continue(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_nb_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_append(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_nb_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_size(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_mdtm(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_rename(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_delete(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_site(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_close(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_set_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given -ftp_get_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_login(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_pwd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_cdup(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_chdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_exec(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_raw(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_mkdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_rmdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_chmod(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_alloc(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_rawlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_mlsd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_systype(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_nb_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_pasv(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_nb_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_nb_continue(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_nb_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_append(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_nb_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_size(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_mdtm(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_rename(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_delete(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_site(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_close(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_set_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +TypeError: ftp_get_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given diff --git a/ext/ftp/tests/dead-resource.phpt b/ext/ftp/tests/dead-resource.phpt index 75cf3c4a55f7..90e59d19641d 100644 --- a/ext/ftp/tests/dead-resource.phpt +++ b/ext/ftp/tests/dead-resource.phpt @@ -16,10 +16,10 @@ try { var_dump(ftp_login($ftp, 'user', 'pass')); echo "Login did not throw\n"; } catch (ValueError $ex) { - echo "Exception: ", $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- bool(true) bool(true) -Exception: FTP\Connection is already closed +ValueError: FTP\Connection is already closed diff --git a/ext/ftp/tests/ftp_close_during_transfer.phpt b/ext/ftp/tests/ftp_close_during_transfer.phpt index 72e410603921..201a6f172681 100644 --- a/ext/ftp/tests/ftp_close_during_transfer.phpt +++ b/ext/ftp/tests/ftp_close_during_transfer.phpt @@ -32,7 +32,7 @@ CloseDuringWrite::$ftp = $ftp; try { @ftp_get($ftp, 'reentrant://sink', 'a story.txt', FTP_BINARY); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ftp_close($ftp); @@ -40,5 +40,5 @@ echo "closed\n"; ?> --EXPECT-- bool(true) -Cannot close FTP\Connection while a transfer is in progress +Error: Cannot close FTP\Connection while a transfer is in progress closed diff --git a/ext/ftp/tests/ftp_constructor.phpt b/ext/ftp/tests/ftp_constructor.phpt index 6fae7f9d3fa0..70ac410ffe6c 100644 --- a/ext/ftp/tests/ftp_constructor.phpt +++ b/ext/ftp/tests/ftp_constructor.phpt @@ -9,8 +9,8 @@ pcntl try { new FTP\Connection(); } catch (Error $ex) { - echo "Exception: ", $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Cannot directly construct FTP\Connection, use ftp_connect() or ftp_ssl_connect() instead +Error: Cannot directly construct FTP\Connection, use ftp_connect() or ftp_ssl_connect() instead diff --git a/ext/ftp/tests/ftp_get_option.phpt b/ext/ftp/tests/ftp_get_option.phpt index 496fceadffe7..56738f2c6c72 100644 --- a/ext/ftp/tests/ftp_get_option.phpt +++ b/ext/ftp/tests/ftp_get_option.phpt @@ -21,7 +21,7 @@ var_dump(ftp_get_option($ftp, FTP_USEPASVADDRESS)); try { ftp_get_option($ftp, FOO_BAR); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> @@ -29,4 +29,4 @@ try { int(%d) bool(true) bool(true) -ftp_get_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS +ValueError: ftp_get_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS diff --git a/ext/ftp/tests/ftp_nb_close_during_transfer.phpt b/ext/ftp/tests/ftp_nb_close_during_transfer.phpt index 702648f69592..aacc4dfd77be 100644 --- a/ext/ftp/tests/ftp_nb_close_during_transfer.phpt +++ b/ext/ftp/tests/ftp_nb_close_during_transfer.phpt @@ -32,7 +32,7 @@ CloseDuringNbWrite::$ftp = $ftp; try { @ftp_nb_get($ftp, 'reentrantnb://sink', 'a story.txt', FTP_BINARY); } catch (\Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ftp_close($ftp); @@ -40,5 +40,5 @@ echo "closed\n"; ?> --EXPECT-- bool(true) -Cannot close FTP\Connection while a transfer is in progress +Error: Cannot close FTP\Connection while a transfer is in progress closed diff --git a/ext/ftp/tests/ftp_set_option_errors.phpt b/ext/ftp/tests/ftp_set_option_errors.phpt index 35785e7f1eba..5b30dfdef2d4 100644 --- a/ext/ftp/tests/ftp_set_option_errors.phpt +++ b/ext/ftp/tests/ftp_set_option_errors.phpt @@ -24,13 +24,13 @@ $options = [ foreach ($options as $option) try { var_dump(ftp_set_option($ftp, $option['option'], $option['value'])); } catch (\Throwable $ex) { - echo "Exception: ", $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Exception: ftp_set_option(): Argument #3 ($value) must be greater than 0 for the FTP_TIMEOUT_SEC option -Exception: ftp_set_option(): Argument #3 ($value) must be of type int for the FTP_TIMEOUT_SEC option, string given -Exception: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_USEPASVADDRESS option, array given -Exception: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_AUTOSEEK option, string given -Exception: ftp_set_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS +ValueError: ftp_set_option(): Argument #3 ($value) must be greater than 0 for the FTP_TIMEOUT_SEC option +TypeError: ftp_set_option(): Argument #3 ($value) must be of type int for the FTP_TIMEOUT_SEC option, string given +TypeError: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_USEPASVADDRESS option, array given +TypeError: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_AUTOSEEK option, string given +ValueError: ftp_set_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS diff --git a/ext/ftp/tests/ftp_ssl_connect_error.phpt b/ext/ftp/tests/ftp_ssl_connect_error.phpt index 65c7efbb23c4..a12a3d4add9b 100644 --- a/ext/ftp/tests/ftp_ssl_connect_error.phpt +++ b/ext/ftp/tests/ftp_ssl_connect_error.phpt @@ -18,7 +18,7 @@ echo "\n-- Testing ftp_ssl_connect() function timeout exception for value 0 --\n try { ftp_ssl_connect('totes.invalid', 21, 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "===DONE===\n"; @@ -32,5 +32,5 @@ Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo for %s failed: bool(false) -- Testing ftp_ssl_connect() function timeout exception for value 0 -- -ftp_ssl_connect(): Argument #3 ($timeout) must be greater than 0 +ValueError: ftp_ssl_connect(): Argument #3 ($timeout) must be greater than 0 ===DONE=== diff --git a/ext/ftp/tests/gh20601.phpt b/ext/ftp/tests/gh20601.phpt index 3ece7736c3aa..f6013db497f2 100644 --- a/ext/ftp/tests/gh20601.phpt +++ b/ext/ftp/tests/gh20601.phpt @@ -12,8 +12,8 @@ if (PHP_OS_FAMILY === 'Windows') die("skip not for windows"); try { ftp_connect('127.0.0.1', 1024, PHP_INT_MAX); } catch (\ValueError $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -ftp_connect(): Argument #3 ($timeout) must be less than %d +ValueError: ftp_connect(): Argument #3 ($timeout) must be less than %d diff --git a/ext/ftp/tests/gh20601_set_option.phpt b/ext/ftp/tests/gh20601_set_option.phpt index 3317d4b5f2a0..c722f4d16448 100644 --- a/ext/ftp/tests/gh20601_set_option.phpt +++ b/ext/ftp/tests/gh20601_set_option.phpt @@ -19,8 +19,8 @@ ftp_login($ftp, 'user', 'pass'); try { ftp_set_option($ftp, FTP_TIMEOUT_SEC, PHP_INT_MAX); } catch (\ValueError $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -ftp_set_option(): Argument #3 ($value) must be less than %d for the FTP_TIMEOUT_SEC option +ValueError: ftp_set_option(): Argument #3 ($value) must be less than %d for the FTP_TIMEOUT_SEC option diff --git a/ext/ftp/tests/gh20601_ssl.phpt b/ext/ftp/tests/gh20601_ssl.phpt index 005f866e18e0..12c1c54ae59c 100644 --- a/ext/ftp/tests/gh20601_ssl.phpt +++ b/ext/ftp/tests/gh20601_ssl.phpt @@ -14,8 +14,8 @@ if (PHP_OS_FAMILY === 'Windows') die("skip not for windows"); try { ftp_ssl_connect('127.0.0.1', 1024, PHP_INT_MAX); } catch (\ValueError $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -ftp_ssl_connect(): Argument #3 ($timeout) must be less than %d +ValueError: ftp_ssl_connect(): Argument #3 ($timeout) must be less than %d From 5f10394876cff1b7c9391ef7c46bb5c92aa52644 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:44 +0000 Subject: [PATCH 07/23] ext/hash: applied fixers to improve test robustness --- ext/hash/tests/bug81714.phpt | 4 +- ext/hash/tests/gh12186_1.phpt | 4 +- ext/hash/tests/gh12186_2.phpt | 4 +- ext/hash/tests/hash_equals.phpt | 14 +-- ext/hash/tests/hash_error.phpt | 4 +- ext/hash/tests/hash_file_error.phpt | 4 +- ext/hash/tests/hash_hkdf_edges.phpt | 4 +- ext/hash/tests/hash_hkdf_error.phpt | 26 +++--- ext/hash/tests/hash_hmac_error.phpt | 8 +- ext/hash/tests/hash_hmac_file_error.phpt | 12 +-- ext/hash/tests/hash_init_error.phpt | 16 ++-- ext/hash/tests/hash_pbkdf2_error.phpt | 20 ++--- ext/hash/tests/hash_serialize_002.phpt | 90 +++++++++---------- ext/hash/tests/hash_serialize_003.phpt | 2 +- ext/hash/tests/hash_serialize_004.phpt | 22 ++--- ext/hash/tests/new-context.phpt | 4 +- ext/hash/tests/reuse.phpt | 4 +- ext/hash/tests/xxhash_secret.phpt | 18 ++-- .../tests/xxhash_unserialize_memsize.phpt | 8 +- 19 files changed, 134 insertions(+), 134 deletions(-) diff --git a/ext/hash/tests/bug81714.phpt b/ext/hash/tests/bug81714.phpt index a151bda6884e..1f8557021a26 100644 --- a/ext/hash/tests/bug81714.phpt +++ b/ext/hash/tests/bug81714.phpt @@ -7,8 +7,8 @@ hash_final($h); try { serialize($h); } catch (Exception $ex) { - var_dump($ex->getMessage()); + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECTF-- -string(52) "HashContext for algorithm "md5" cannot be serialized" +Exception: HashContext for algorithm "md5" cannot be serialized diff --git a/ext/hash/tests/gh12186_1.phpt b/ext/hash/tests/gh12186_1.phpt index 5e34b1dd78e8..afdfe5f7dbfe 100644 --- a/ext/hash/tests/gh12186_1.phpt +++ b/ext/hash/tests/gh12186_1.phpt @@ -9,9 +9,9 @@ hash_final($c); try { hash_copy($c); } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECTF-- -hash_copy(): Argument #1 ($context) must be a valid, non-finalized HashContext +TypeError: hash_copy(): Argument #1 ($context) must be a valid, non-finalized HashContext diff --git a/ext/hash/tests/gh12186_2.phpt b/ext/hash/tests/gh12186_2.phpt index 64a12b15c391..46dc1232642b 100644 --- a/ext/hash/tests/gh12186_2.phpt +++ b/ext/hash/tests/gh12186_2.phpt @@ -9,9 +9,9 @@ hash_final($c); try { clone $c; } catch (Throwable $ex) { - echo $ex->getMessage() . "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECTF-- -Cannot clone a finalized HashContext +ValueError: Cannot clone a finalized HashContext diff --git a/ext/hash/tests/hash_equals.phpt b/ext/hash/tests/hash_equals.phpt index 69e23eea0fa3..c01e7be8c858 100644 --- a/ext/hash/tests/hash_equals.phpt +++ b/ext/hash/tests/hash_equals.phpt @@ -9,7 +9,7 @@ function trycatch_dump(...$tests) { var_dump($test()); } catch (\Error $e) { - echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -39,9 +39,9 @@ bool(false) bool(false) bool(false) bool(true) -[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, int given -[TypeError] hash_equals(): Argument #2 ($user_string) must be of type string, int given -[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, int given -[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, null given -[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, null given -[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, null given +TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, int given +TypeError: hash_equals(): Argument #2 ($user_string) must be of type string, int given +TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, int given +TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given +TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given +TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt index b5c038809139..63e99de72932 100644 --- a/ext/hash/tests/hash_error.phpt +++ b/ext/hash/tests/hash_error.phpt @@ -9,7 +9,7 @@ echo "\n-- Testing hash() function with invalid hash algorithm --\n"; try { hash('foo', ''); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> @@ -17,4 +17,4 @@ try { *** Testing hash() : error conditions *** -- Testing hash() function with invalid hash algorithm -- -hash(): Argument #1 ($algo) must be a valid hashing algorithm +ValueError: hash(): Argument #1 ($algo) must be a valid hashing algorithm diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index 68ba55f4a373..a381d3bdd63c 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -16,7 +16,7 @@ echo "\n-- Testing hash_file() function with an unknown algorithm --\n"; try { hash_file('foobar', $filename); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "\n-- Testing hash_file() function with a non-existent file --\n"; @@ -34,7 +34,7 @@ unlink( $filename ); *** Testing hash_file() : error conditions *** -- Testing hash_file() function with an unknown algorithm -- -hash_file(): Argument #1 ($algo) must be a valid hashing algorithm +ValueError: hash_file(): Argument #1 ($algo) must be a valid hashing algorithm -- Testing hash_file() function with a non-existent file -- diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt index 89b3d8af6354..77481802470e 100644 --- a/ext/hash/tests/hash_hkdf_edges.phpt +++ b/ext/hash/tests/hash_hkdf_edges.phpt @@ -16,7 +16,7 @@ try { var_dump(hash_hkdf('jOaAt', $ikm)); } catch (\Error $e) { - echo '[Error] ' . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -26,4 +26,4 @@ Length < digestSize: 98b16391063ece Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f Algo name case-sensitivity: true Non-crypto algo name case-sensitivity: -[Error] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt index 86aa10a02f35..f68d7a62fca1 100644 --- a/ext/hash/tests/hash_hkdf_error.phpt +++ b/ext/hash/tests/hash_hkdf_error.phpt @@ -11,7 +11,7 @@ function trycatch_dump(...$tests) { var_dump($test()); } catch (\Error $e) { - echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } } @@ -48,19 +48,19 @@ trycatch_dump( *** Testing hash_hkdf(): error conditions *** -- Testing hash_hkdf() function with invalid hash algorithm -- -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with non-cryptographic hash algorithm -- -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hkdf() function with invalid parameters -- -[ValueError] hash_hkdf(): Argument #2 ($key) must not be empty -[ValueError] hash_hkdf(): Argument #3 ($length) must be greater than or equal to 0 -[ValueError] hash_hkdf(): Argument #3 ($length) must be less than or equal to 5100 +ValueError: hash_hkdf(): Argument #2 ($key) must not be empty +ValueError: hash_hkdf(): Argument #3 ($length) must be greater than or equal to 0 +ValueError: hash_hkdf(): Argument #3 ($length) must be less than or equal to 5100 diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt index 81c28ee46c05..ad92d4a26ceb 100644 --- a/ext/hash/tests/hash_hmac_error.phpt +++ b/ext/hash/tests/hash_hmac_error.phpt @@ -16,7 +16,7 @@ try { var_dump(hash_hmac('foo', $data, $key)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_hmac() function with non-cryptographic hash algorithm --\n"; @@ -24,7 +24,7 @@ try { var_dump(hash_hmac('crc32', $data, $key)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -32,7 +32,7 @@ catch (\Error $e) { *** Testing hash_hmac() : error conditions *** -- Testing hash_hmac() function with invalid hash algorithm -- -hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac() function with non-cryptographic hash algorithm -- -hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 3a4d85ee7e35..c882975fed24 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -13,7 +13,7 @@ try { var_dump(hash_hmac_file('foo', $file, $key, TRUE)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --\n"; @@ -21,7 +21,7 @@ try { var_dump(hash_hmac_file('crc32', $file, $key, TRUE)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_hmac_file() function with bad path --\n"; @@ -29,7 +29,7 @@ try { var_dump(hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE)); } catch (ValueError $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -37,10 +37,10 @@ catch (ValueError $e) { *** Testing hash() : error conditions *** -- Testing hash_hmac_file() function with invalid hash algorithm -- -hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with non-cryptographic hash algorithm -- -hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with bad path -- -hash_hmac_file(): Argument #2 ($filename) must not contain any null bytes +ValueError: hash_hmac_file(): Argument #2 ($filename) must not contain any null bytes diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt index 560ad4f8e9ae..76fa392f6b21 100644 --- a/ext/hash/tests/hash_init_error.phpt +++ b/ext/hash/tests/hash_init_error.phpt @@ -9,7 +9,7 @@ try { var_dump(hash_init('dummy')); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --\n"; @@ -17,7 +17,7 @@ try { var_dump(hash_init('crc32', HASH_HMAC)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_init() function with HASH_HMAC and no key --\n"; @@ -25,14 +25,14 @@ try { var_dump(hash_init('md5', HASH_HMAC)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(hash_init('md5', HASH_HMAC, null)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -41,13 +41,13 @@ catch (\Error $e) { *** Testing hash_init(): error conditions *** -- Testing hash_init() function with unknown algorithms -- -hash_init(): Argument #1 ($algo) must be a valid hashing algorithm +ValueError: hash_init(): Argument #1 ($algo) must be a valid hashing algorithm -- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms -- -hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested +ValueError: hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested -- Testing hash_init() function with HASH_HMAC and no key -- -hash_init(): Argument #3 ($key) must not be empty when HMAC is requested +ValueError: hash_init(): Argument #3 ($key) must not be empty when HMAC is requested Deprecated: hash_init(): Passing null to parameter #3 ($key) of type string is deprecated in %s on line %d -hash_init(): Argument #3 ($key) must not be empty when HMAC is requested +ValueError: hash_init(): Argument #3 ($key) must not be empty when HMAC is requested diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt index 35cda2b52fc6..d07a8caa2344 100644 --- a/ext/hash/tests/hash_pbkdf2_error.phpt +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -16,7 +16,7 @@ try { var_dump(hash_pbkdf2('foo', $password, $salt, 1)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -25,7 +25,7 @@ try { var_dump(hash_pbkdf2('crc32', $password, $salt, 1)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_pbkdf2() function with invalid iterations --\n"; @@ -33,14 +33,14 @@ try { var_dump(hash_pbkdf2('md5', $password, $salt, 0)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(hash_pbkdf2('md5', $password, $salt, -1)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\n-- Testing hash_pbkdf2() function with invalid length --\n"; @@ -48,7 +48,7 @@ try { var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1)); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -56,14 +56,14 @@ catch (\Error $e) { *** Testing hash_pbkdf2() : error conditions *** -- Testing hash_pbkdf2() function with invalid hash algorithm -- -hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_pbkdf2() function with non-cryptographic hash algorithm -- -hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm +ValueError: hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_pbkdf2() function with invalid iterations -- -hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0 -hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0 +ValueError: hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0 +ValueError: hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0 -- Testing hash_pbkdf2() function with invalid length -- -hash_pbkdf2(): Argument #5 ($length) must be greater than or equal to 0 +ValueError: hash_pbkdf2(): Argument #5 ($length) must be greater than or equal to 0 diff --git a/ext/hash/tests/hash_serialize_002.phpt b/ext/hash/tests/hash_serialize_002.phpt index 15ecf94c1e5e..40157bf3800c 100644 --- a/ext/hash/tests/hash_serialize_002.phpt +++ b/ext/hash/tests/hash_serialize_002.phpt @@ -18,7 +18,7 @@ foreach ($algos as $algo) { $serial = serialize($ctx0); assert(is_string($serial)); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -26,91 +26,91 @@ echo "Done\n"; ?> --EXPECT-- string(3) "md2" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(3) "md4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(3) "md5" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(4) "sha1" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(6) "sha224" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(6) "sha256" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(6) "sha384" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "sha512/224" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "sha512/256" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(6) "sha512" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(8) "sha3-224" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(8) "sha3-256" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(8) "sha3-384" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(8) "sha3-512" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(9) "ripemd128" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(9) "ripemd160" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(9) "ripemd256" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(9) "ripemd320" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(9) "whirlpool" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "tiger128,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "tiger160,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "tiger192,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "tiger128,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "tiger160,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "tiger192,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(6) "snefru" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(9) "snefru256" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(4) "gost" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(11) "gost-crypto" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval128,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval160,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval192,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval224,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval256,3" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval128,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval160,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval192,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval224,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval256,4" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval128,5" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval160,5" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval192,5" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval224,5" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized string(10) "haval256,5" -HashContext with HASH_HMAC option cannot be serialized +Exception: HashContext with HASH_HMAC option cannot be serialized Done diff --git a/ext/hash/tests/hash_serialize_003.phpt b/ext/hash/tests/hash_serialize_003.phpt index a687c2aeffbd..541a3169e53e 100644 --- a/ext/hash/tests/hash_serialize_003.phpt +++ b/ext/hash/tests/hash_serialize_003.phpt @@ -237,7 +237,7 @@ function test_serialization($serial, $hash, $algo) { } } catch (Throwable $e) { echo "$algo: problem with serialization {$serial}\n"; - echo " ", $e->getMessage(), "\n", $e->getTraceAsString(); + echo ' ', $e::class . ': ' . $e->getMessage(), "\n", $e->getTraceAsString(); } } diff --git a/ext/hash/tests/hash_serialize_004.phpt b/ext/hash/tests/hash_serialize_004.phpt index ee5c08f973e2..6c6f99365756 100644 --- a/ext/hash/tests/hash_serialize_004.phpt +++ b/ext/hash/tests/hash_serialize_004.phpt @@ -8,7 +8,7 @@ $ctx = hash_init("sha256"); try { $ctx->__unserialize($ctx->__serialize()); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // bad formats @@ -26,20 +26,20 @@ foreach ([ $ctx = unserialize(base64_decode($serial)); echo "Unexpected success\n"; } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } echo "Done\n"; ?> --EXPECT-- -HashContext::__unserialize called on initialized object -Incomplete or ill-formed serialization data -Incomplete or ill-formed serialization data -Incomplete or ill-formed serialization data -HashContext with HASH_HMAC option cannot be serialized -Incomplete or ill-formed serialization data ("sha1" code -1) -Incomplete or ill-formed serialization data ("sha1" code -1024) -Incomplete or ill-formed serialization data ("sha1" code -1) -Unknown hash algorithm +Exception: HashContext::__unserialize called on initialized object +Exception: Incomplete or ill-formed serialization data +Exception: Incomplete or ill-formed serialization data +Exception: Incomplete or ill-formed serialization data +Exception: HashContext with HASH_HMAC option cannot be serialized +Exception: Incomplete or ill-formed serialization data ("sha1" code -1) +Exception: Incomplete or ill-formed serialization data ("sha1" code -1024) +Exception: Incomplete or ill-formed serialization data ("sha1" code -1) +Exception: Unknown hash algorithm Done diff --git a/ext/hash/tests/new-context.phpt b/ext/hash/tests/new-context.phpt index dd8e92e029b6..345f53adfceb 100644 --- a/ext/hash/tests/new-context.phpt +++ b/ext/hash/tests/new-context.phpt @@ -6,8 +6,8 @@ Hash: Attempt to instantiate a HashContext directly try { new HashContext; } catch (Error $e) { - echo "Exception: {$e->getMessage()}\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Call to private HashContext::__construct() from global scope +Error: Call to private HashContext::__construct() from global scope diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt index b5cfc79c162d..9ca8f4ceda65 100644 --- a/ext/hash/tests/reuse.phpt +++ b/ext/hash/tests/reuse.phpt @@ -9,9 +9,9 @@ try { hash_update($h, 'foo'); } catch (\Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -hash_update(): Argument #1 ($context) must be a valid, non-finalized HashContext +TypeError: hash_update(): Argument #1 ($context) must be a valid, non-finalized HashContext diff --git a/ext/hash/tests/xxhash_secret.phpt b/ext/hash/tests/xxhash_secret.phpt index 4cd6798ef769..768032169afa 100644 --- a/ext/hash/tests/xxhash_secret.phpt +++ b/ext/hash/tests/xxhash_secret.phpt @@ -18,19 +18,19 @@ foreach (["xxh3", "xxh128"] as $a) { try { $ctx = hash_init($a, options: ["seed" => 24, "secret" => $secret]); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ctx = hash_init($a, options: ["secret" => new StringableThrowingClass()]); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $ctx = hash_init($a, options: ["secret" => str_repeat('a', 17)]); } catch (Throwable $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } $ctx = hash_init($a, options: ["secret" => $secret]); @@ -47,15 +47,15 @@ foreach (["xxh3", "xxh128"] as $a) { ?> --EXPECTF-- -string(67) "xxh3: Only one of seed or secret is to be passed for initialization" +Error: xxh3: Only one of seed or secret is to be passed for initialization Deprecated: hash_init(): Passing a secret of a type other than string is deprecated because it implicitly converts to a string, potentially hiding bugs in %s on line %d -string(23) "exception in __toString" -string(57) "xxh3: Secret length must be >= 136 bytes, 17 bytes passed" +Exception: exception in __toString +Error: xxh3: Secret length must be >= 136 bytes, 17 bytes passed 8028aa834c03557a == 8028aa834c03557a == true -string(69) "xxh128: Only one of seed or secret is to be passed for initialization" +Error: xxh128: Only one of seed or secret is to be passed for initialization Deprecated: hash_init(): Passing a secret of a type other than string is deprecated because it implicitly converts to a string, potentially hiding bugs in %s on line %d -string(23) "exception in __toString" -string(59) "xxh128: Secret length must be >= 136 bytes, 17 bytes passed" +Exception: exception in __toString +Error: xxh128: Secret length must be >= 136 bytes, 17 bytes passed 54279097795e7218093a05d4d781cbb9 == 54279097795e7218093a05d4d781cbb9 == true diff --git a/ext/hash/tests/xxhash_unserialize_memsize.phpt b/ext/hash/tests/xxhash_unserialize_memsize.phpt index 6de78ee0711e..d287f0a368fd 100644 --- a/ext/hash/tests/xxhash_unserialize_memsize.phpt +++ b/ext/hash/tests/xxhash_unserialize_memsize.phpt @@ -9,7 +9,7 @@ try { $hash = unserialize($str); hash_update($hash, ''); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -19,9 +19,9 @@ try { $hash = unserialize($str); hash_update($hash, ''); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Incomplete or ill-formed serialization data ("xxh32" code -2000) -Incomplete or ill-formed serialization data ("xxh64" code -2000) +Exception: Incomplete or ill-formed serialization data ("xxh32" code -2000) +Exception: Incomplete or ill-formed serialization data ("xxh64" code -2000) From e185b2acd5615efa1248bf8e8a9a730990084d4c Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:45 +0000 Subject: [PATCH 08/23] ext/iconv: applied fixers to improve test robustness --- ext/iconv/tests/bug78069.phpt | 2 +- ext/iconv/tests/iconv_strpos.phpt | 8 +++---- ext/iconv/tests/iconv_strpos_variation5.phpt | 24 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ext/iconv/tests/bug78069.phpt b/ext/iconv/tests/bug78069.phpt index 88cf6e35f82d..1c2fdd1a64c0 100644 --- a/ext/iconv/tests/bug78069.phpt +++ b/ext/iconv/tests/bug78069.phpt @@ -10,4 +10,4 @@ var_dump(count($hdr)); DONE --EXPECT-- int(1) -DONE \ No newline at end of file +DONE diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt index c32fe921e624..e423c694b391 100644 --- a/ext/iconv/tests/iconv_strpos.phpt +++ b/ext/iconv/tests/iconv_strpos.phpt @@ -14,7 +14,7 @@ function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = fal try { var_dump(strpos($haystk, $needle, $offset)); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { if ($to_charset !== false) { @@ -23,7 +23,7 @@ function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = fal var_dump(iconv_strpos($haystk, $needle, $offset)); } } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } foo("abecdbcdabef", "bcd", -1); @@ -48,8 +48,8 @@ int(5) int(5) bool(false) bool(false) -strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) int(7) int(7) int(16) diff --git a/ext/iconv/tests/iconv_strpos_variation5.phpt b/ext/iconv/tests/iconv_strpos_variation5.phpt index 2cf4b947616f..ae7487a19e9f 100644 --- a/ext/iconv/tests/iconv_strpos_variation5.phpt +++ b/ext/iconv/tests/iconv_strpos_variation5.phpt @@ -32,13 +32,13 @@ for ($i = -30; $i <= 60; $i += 10) { try { var_dump(iconv_strpos($string_ascii, $needle_ascii, $i)); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--Multibyte String --\n"; try { var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8')); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -49,9 +49,9 @@ echo "Done"; **-- Offset is: -30 --** -- ASCII String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --Multibyte String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) **-- Offset is: -20 --** -- ASCII String -- @@ -85,25 +85,25 @@ int(20) **-- Offset is: 30 --** -- ASCII String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --Multibyte String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) **-- Offset is: 40 --** -- ASCII String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --Multibyte String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) **-- Offset is: 50 --** -- ASCII String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --Multibyte String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) **-- Offset is: 60 --** -- ASCII String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --Multibyte String -- -iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) Done From 525068f3787e25286d48c0780e8bc37a7f8484e6 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:45 +0000 Subject: [PATCH 09/23] ext/ldap: applied fixers to improve test robustness --- ext/ldap/tests/gh18902.phpt | 12 ++++++------ ext/ldap/tests/gh21262.phpt | 12 ++++++------ ext/ldap/tests/ldap_connect_port_error.phpt | 8 ++++---- ext/ldap/tests/ldap_constructor.phpt | 4 ++-- ext/ldap/tests/ldap_first_attribute_error.phpt | 4 ++-- .../tests/ldap_get_set_invalid_option_error.phpt | 4 ++-- ...list_read_search_parallel_programming_errors.phpt | 2 +- ext/ldap/tests/ldap_set_option_error.phpt | 2 +- ext/ldap/tests/ldap_sort_control_missing_attr.phpt | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ext/ldap/tests/gh18902.phpt b/ext/ldap/tests/gh18902.phpt index 329cbb59c1b1..0df0543a8f75 100644 --- a/ext/ldap/tests/gh18902.phpt +++ b/ext/ldap/tests/gh18902.phpt @@ -9,22 +9,22 @@ $conn = ldap_connect(); try { ldap_exop($conn,"\0"); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { ldap_exop_sync($conn,""); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { ldap_exop_sync($conn,"test\0"); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -ldap_exop(): Argument #2 ($request_oid) must not contain any null bytes -ldap_exop_sync(): Argument #2 ($request_oid) must not be empty -ldap_exop_sync(): Argument #2 ($request_oid) must not contain any null bytes +ValueError: ldap_exop(): Argument #2 ($request_oid) must not contain any null bytes +ValueError: ldap_exop_sync(): Argument #2 ($request_oid) must not be empty +ValueError: ldap_exop_sync(): Argument #2 ($request_oid) must not contain any null bytes diff --git a/ext/ldap/tests/gh21262.phpt b/ext/ldap/tests/gh21262.phpt index 3e414a9cbb12..52336ee070d1 100644 --- a/ext/ldap/tests/gh21262.phpt +++ b/ext/ldap/tests/gh21262.phpt @@ -17,14 +17,14 @@ $entry_with_empty_array = [ try { ldap_add($ldap, $valid_dn, $entry_with_empty_array); } catch (ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // ldap_mod_add() should still reject empty arrays try { ldap_mod_add($ldap, $valid_dn, $entry_with_empty_array); } catch (ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // ldap_modify() should accept empty arrays (delete attribute) @@ -32,7 +32,7 @@ try { @ldap_modify($ldap, $valid_dn, $entry_with_empty_array); echo "ldap_modify: no ValueError thrown", PHP_EOL; } catch (ValueError $e) { - echo "ldap_modify: UNEXPECTED ValueError: ", $e->getMessage(), PHP_EOL; + echo 'ldap_modify: UNEXPECTED: ', $e::class, ': ', $e->getMessage(), PHP_EOL; } // ldap_mod_del() should accept empty arrays (delete attribute) @@ -40,11 +40,11 @@ try { @ldap_mod_del($ldap, $valid_dn, $entry_with_empty_array); echo "ldap_mod_del: no ValueError thrown", PHP_EOL; } catch (ValueError $e) { - echo "ldap_mod_del: UNEXPECTED ValueError: ", $e->getMessage(), PHP_EOL; + echo 'ldap_mod_del: UNEXPECTED: ', $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -ldap_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values -ldap_mod_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values +ValueError: ldap_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values +ValueError: ldap_mod_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values ldap_modify: no ValueError thrown ldap_mod_del: no ValueError thrown diff --git a/ext/ldap/tests/ldap_connect_port_error.phpt b/ext/ldap/tests/ldap_connect_port_error.phpt index 55d41d395b13..8809b84d8a0e 100644 --- a/ext/ldap/tests/ldap_connect_port_error.phpt +++ b/ext/ldap/tests/ldap_connect_port_error.phpt @@ -10,15 +10,15 @@ require "connect.inc"; try { ldap_connect("nope://$host", 65536); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { ldap_connect("nope://$host", 0); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -ldap_connect(): Argument #2 ($port) must be between 1 and 65535 -ldap_connect(): Argument #2 ($port) must be between 1 and 65535 +ValueError: ldap_connect(): Argument #2 ($port) must be between 1 and 65535 +ValueError: ldap_connect(): Argument #2 ($port) must be between 1 and 65535 diff --git a/ext/ldap/tests/ldap_constructor.phpt b/ext/ldap/tests/ldap_constructor.phpt index d405bd33d903..f48d14dfa983 100644 --- a/ext/ldap/tests/ldap_constructor.phpt +++ b/ext/ldap/tests/ldap_constructor.phpt @@ -8,8 +8,8 @@ ldap try { new LDAP\Connection(); } catch (Error $ex) { - echo "Exception: ", $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Exception: Cannot directly construct LDAP\Connection, use ldap_connect() instead +Error: Cannot directly construct LDAP\Connection, use ldap_connect() instead diff --git a/ext/ldap/tests/ldap_first_attribute_error.phpt b/ext/ldap/tests/ldap_first_attribute_error.phpt index 2776838501d3..c84ca8607b7b 100644 --- a/ext/ldap/tests/ldap_first_attribute_error.phpt +++ b/ext/ldap/tests/ldap_first_attribute_error.phpt @@ -13,8 +13,8 @@ $link = ldap_connect($uri); try { var_dump(ldap_first_attribute($link, $link)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -ldap_first_attribute(): Argument #2 ($entry) must be of type LDAP\ResultEntry, LDAP\Connection given +TypeError: ldap_first_attribute(): Argument #2 ($entry) must be of type LDAP\ResultEntry, LDAP\Connection given diff --git a/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt b/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt index 2079353e48c9..dacaa9c9836e 100644 --- a/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt +++ b/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt @@ -9,12 +9,12 @@ $ldap = ldap_connect('ldap://127.0.0.1:3333'); try { var_dump(ldap_set_option($ldap, 999999, "bogus")); } catch (Throwable $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(ldap_get_option($ldap, 999999, $value)); } catch (Throwable $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt b/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt index 4f3567d9e00b..286b44706aa5 100644 --- a/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt +++ b/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt @@ -110,4 +110,4 @@ ValueError: ldap_list(): Argument #3 ($filter) must be the same size as argument TypeError: ldap_list(): Argument #2 ($base) must be a list of strings, int given TypeError: ldap_list(): Argument #3 ($filter) must be a list of strings, int given ValueError: ldap_list(): Argument #2 ($base) must not contain null bytes -ValueError: ldap_list(): Argument #3 ($filter) must not contain null bytes \ No newline at end of file +ValueError: ldap_list(): Argument #3 ($filter) must not contain null bytes diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt index eda3dc512173..92b84a2e9174 100644 --- a/ext/ldap/tests/ldap_set_option_error.phpt +++ b/ext/ldap/tests/ldap_set_option_error.phpt @@ -29,7 +29,7 @@ foreach ($controls as $control) { try { var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control)); } catch (Error $exception) { - echo get_class($exception) . ": " . $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } } diff --git a/ext/ldap/tests/ldap_sort_control_missing_attr.phpt b/ext/ldap/tests/ldap_sort_control_missing_attr.phpt index 0d6c3921f008..606894b7f374 100644 --- a/ext/ldap/tests/ldap_sort_control_missing_attr.phpt +++ b/ext/ldap/tests/ldap_sort_control_missing_attr.phpt @@ -20,11 +20,11 @@ try { ], ]); } catch (\ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "ok\n"; ?> --EXPECT-- -ldap_search(): Sort key list must have an "attr" key +ValueError: ldap_search(): Sort key list must have an "attr" key ok From 5f7cebc20c5cf5e0d557643f2ed749dafdd292f6 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:45 +0000 Subject: [PATCH 10/23] ext/pcre: applied fixers to improve test robustness --- ext/pcre/tests/002.phpt | 4 ++-- ext/pcre/tests/bug21732.phpt | 4 ++-- ext/pcre/tests/gh16189.phpt | 8 ++++---- ext/pcre/tests/preg_grep_error1.phpt | 9 ++++----- ext/pcre/tests/preg_match_all_error1.phpt | 9 ++++----- ext/pcre/tests/preg_match_error1.phpt | 9 ++++----- ext/pcre/tests/preg_replace_callback_array2.phpt | 8 ++++---- ext/pcre/tests/preg_replace_error1.phpt | 5 ++--- ext/pcre/tests/preg_replace_error2.phpt | 8 ++++---- ext/pcre/tests/preg_split_error1.phpt | 9 ++++----- 10 files changed, 34 insertions(+), 39 deletions(-) diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt index 14d196402062..ac3e54db459c 100644 --- a/ext/pcre/tests/002.phpt +++ b/ext/pcre/tests/002.phpt @@ -6,7 +6,7 @@ preg_* with bogus vals try { preg_match_all('//', '', $dummy, 0xdead); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(preg_quote('')); @@ -17,7 +17,7 @@ var_dump(preg_replace('/(.)/e', 'for ($', 'abc')); ?> --EXPECTF-- -preg_match_all(): Argument #4 ($flags) must be a PREG_* constant +ValueError: preg_match_all(): Argument #4 ($flags) must be a PREG_* constant string(0) "" string(12) "a${1b${1c${1" diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt index 02a13713e2ed..6fcbf47e3058 100644 --- a/ext/pcre/tests/bug21732.phpt +++ b/ext/pcre/tests/bug21732.phpt @@ -12,12 +12,12 @@ class foo { try { var_dump(preg_replace('', array(), '')); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde')); ?> --EXPECT-- -preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given +TypeError: preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given array(4) { [0]=> string(5) "abcde" diff --git a/ext/pcre/tests/gh16189.phpt b/ext/pcre/tests/gh16189.phpt index c77ab7699eed..6e7dbaaf3941 100644 --- a/ext/pcre/tests/gh16189.phpt +++ b/ext/pcre/tests/gh16189.phpt @@ -6,14 +6,14 @@ GH-16189 (preg_match/preg_match_all underflow on start_offset argument) try { preg_match( '/<(\w+)[\s\w\-]+ id="S44_i89ew">/', '
', $matches, 0, PHP_INT_MIN); } catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { preg_match_all( '/<(\w+)[\s\w\-]+ id="S44_i89ew">/', '
', $matches, 0, PHP_INT_MIN); } catch (\ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -preg_match(): Argument #5 ($offset) must be greater than %s -preg_match_all(): Argument #5 ($offset) must be greater than %s +ValueError: preg_match(): Argument #5 ($offset) must be greater than %s +ValueError: preg_match_all(): Argument #5 ($offset) must be greater than %s diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt index ae80ecc3506f..0c1a4733ca90 100644 --- a/ext/pcre/tests/preg_grep_error1.phpt +++ b/ext/pcre/tests/preg_grep_error1.phpt @@ -25,18 +25,17 @@ foreach ($values as $value) { try { var_dump(preg_grep($value, $array)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } $value = new stdclass(); //Object try { var_dump(preg_grep($value, $array)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- - Warning: preg_grep(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_grep_error1.php on line %d bool(false) @@ -48,11 +47,11 @@ bool(false) Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d bool(false) -preg_grep(): Argument #1 ($pattern) must be of type string, array given +TypeError: preg_grep(): Argument #1 ($pattern) must be of type string, array given array(2) { [1]=> string(3) "abc" [2]=> string(4) "test" } -preg_grep(): Argument #1 ($pattern) must be of type string, stdClass given +TypeError: preg_grep(): Argument #1 ($pattern) must be of type string, stdClass given diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt index 92d1a6aff664..4965cc1913bb 100644 --- a/ext/pcre/tests/preg_match_all_error1.phpt +++ b/ext/pcre/tests/preg_match_all_error1.phpt @@ -25,7 +25,7 @@ foreach ($regex_array as $regex_value) { try { var_dump(preg_match_all($regex_value, $subject, $matches1)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($matches1); } @@ -33,12 +33,11 @@ $regex_value = new stdclass(); //Object try { var_dump(preg_match_all($regex_value, $subject, $matches)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($matches); ?> --EXPECTF-- - Warning: preg_match_all(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_match_all_error1.php on line %d bool(false) NULL @@ -54,7 +53,7 @@ NULL Warning: preg_match_all(): Unknown modifier 'F' in %spreg_match_all_error1.php on line %d bool(false) NULL -preg_match_all(): Argument #1 ($pattern) must be of type string, array given +TypeError: preg_match_all(): Argument #1 ($pattern) must be of type string, array given NULL int(4) array(1) { @@ -70,5 +69,5 @@ array(1) { string(1) "t" } } -preg_match_all(): Argument #1 ($pattern) must be of type string, stdClass given +TypeError: preg_match_all(): Argument #1 ($pattern) must be of type string, stdClass given NULL diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt index 870cc498792c..6507f9e47dd6 100644 --- a/ext/pcre/tests/preg_match_error1.phpt +++ b/ext/pcre/tests/preg_match_error1.phpt @@ -23,19 +23,18 @@ foreach ($regex_array as $regex_value) { try { var_dump(preg_match($regex_value, $subject)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } $regex_value = new stdclass(); //Object try { var_dump(preg_match($regex_value, $subject)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- - Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_match_error1.php on line %d bool(false) @@ -47,6 +46,6 @@ bool(false) Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line %d bool(false) -preg_match(): Argument #1 ($pattern) must be of type string, array given +TypeError: preg_match(): Argument #1 ($pattern) must be of type string, array given int(1) -preg_match(): Argument #1 ($pattern) must be of type string, stdClass given +TypeError: preg_match(): Argument #1 ($pattern) must be of type string, stdClass given diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt index aca11dc19c6f..ffdcdea71db5 100644 --- a/ext/pcre/tests/preg_replace_callback_array2.phpt +++ b/ext/pcre/tests/preg_replace_callback_array2.phpt @@ -9,7 +9,7 @@ $b = ""; try { var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b)); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } @@ -24,16 +24,16 @@ var_dump(preg_replace_callback_array(array('/\w' => 'f'), 'z')); try { var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z')); } catch (Exception $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- -preg_replace_callback_array(): Argument #1 ($pattern) must contain only valid callbacks +TypeError: preg_replace_callback_array(): Argument #1 ($pattern) must contain only valid callbacks string(0) "" Warning: preg_replace_callback_array(): No ending delimiter '/' found in %spreg_replace_callback_array2.php on line %d NULL -string(1) "1" +Exception: 1 Done diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt index 0a8a79751a9a..5219496a5535 100644 --- a/ext/pcre/tests/preg_replace_error1.phpt +++ b/ext/pcre/tests/preg_replace_error1.phpt @@ -29,11 +29,10 @@ $regex_value = new stdclass(); //Object try { var_dump(preg_replace($regex_value, $replace, $subject)); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- - Warning: preg_replace(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_error1.php on line %d NULL @@ -47,4 +46,4 @@ Warning: preg_replace(): Unknown modifier 'F' in %spreg_replace_error1.php on li NULL string(1) "a" string(1) "1" -preg_replace(): Argument #1 ($pattern) must be of type array|string, stdClass given +TypeError: preg_replace(): Argument #1 ($pattern) must be of type array|string, stdClass given diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt index 9bc36f655f48..6b4a1bfae934 100644 --- a/ext/pcre/tests/preg_replace_error2.phpt +++ b/ext/pcre/tests/preg_replace_error2.phpt @@ -15,17 +15,17 @@ foreach($replace as $value) { try { var_dump(preg_replace($regex, $value, $subject)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } $value = new stdclass(); //Object try { var_dump(preg_replace($regex, $value, $subject)); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(64) "this is a stringthis is a stringthis is a stringthis is a string" -preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given -preg_replace(): Argument #2 ($replacement) must be of type array|string, stdClass given +TypeError: preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given +TypeError: preg_replace(): Argument #2 ($replacement) must be of type array|string, stdClass given diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt index 6555f21366ad..9e9fd8c7133d 100644 --- a/ext/pcre/tests/preg_split_error1.phpt +++ b/ext/pcre/tests/preg_split_error1.phpt @@ -25,18 +25,17 @@ foreach ($regex_array as $regex_value) { try { var_dump(preg_split($regex_value, $subject)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } $regex_value = new stdclass(); //Object try { var_dump(preg_split($regex_value, $subject)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- - Warning: preg_split(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_split_error1.php on line %d bool(false) @@ -48,7 +47,7 @@ bool(false) Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line %d bool(false) -preg_split(): Argument #1 ($pattern) must be of type string, array given +TypeError: preg_split(): Argument #1 ($pattern) must be of type string, array given array(3) { [0]=> string(4) "1 2 " @@ -57,4 +56,4 @@ array(3) { [2]=> string(4) " 5 6" } -preg_split(): Argument #1 ($pattern) must be of type string, stdClass given +TypeError: preg_split(): Argument #1 ($pattern) must be of type string, stdClass given From 7b61dae8d81c3358a2b354956fdacad6f9cf9d3a Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:46 +0000 Subject: [PATCH 11/23] ext/posix: applied fixers to improve test robustness --- ext/posix/tests/posix_access_flags.phpt | 12 ++++++------ ext/posix/tests/posix_eaccess.phpt | 4 ++-- ext/posix/tests/posix_fpathconf.phpt | 5 ++--- ext/posix/tests/posix_getsid_error.phpt | 4 ++-- ext/posix/tests/posix_kill_pidoverflow.phpt | 8 ++++---- ext/posix/tests/posix_pathconf.phpt | 4 ++-- ext/posix/tests/posix_setpgid_error.phpt | 16 ++++++++-------- ext/posix/tests/posix_setrlimit.phpt | 12 ++++++------ .../tests/posix_ttyname_error_wrongparams.phpt | 4 ++-- 9 files changed, 34 insertions(+), 35 deletions(-) diff --git a/ext/posix/tests/posix_access_flags.phpt b/ext/posix/tests/posix_access_flags.phpt index 0989e2a2bc66..ba2104e6dc1f 100644 --- a/ext/posix/tests/posix_access_flags.phpt +++ b/ext/posix/tests/posix_access_flags.phpt @@ -18,19 +18,19 @@ file_put_contents($testfile, "hello"); try { posix_access($testfile, -1); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { posix_access($testfile, 01000); // S_ISVTX bit (sticky) } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { posix_access($testfile, 02000); // S_ISGID bit } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } if (posix_access($testfile, POSIX_R_OK | POSIX_W_OK)) { @@ -47,8 +47,8 @@ if (posix_access($testfile, POSIX_F_OK)) { @unlink(__DIR__ . '/testfile.txt'); ?> --EXPECTF-- -posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK -posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK -posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK +ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK +ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK +ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK Read/write access OK File exists OK diff --git a/ext/posix/tests/posix_eaccess.phpt b/ext/posix/tests/posix_eaccess.phpt index 4211e6ef13e7..22c1577e4938 100644 --- a/ext/posix/tests/posix_eaccess.phpt +++ b/ext/posix/tests/posix_eaccess.phpt @@ -12,9 +12,9 @@ if (!function_exists("posix_eaccess")) die("skip only platforms with posix_eacce try { posix_eaccess(str_repeat('bogus path', 1042)); } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -posix_eaccess(): Argument #1 ($filename) must not be empty +ValueError: posix_eaccess(): Argument #1 ($filename) must not be empty diff --git a/ext/posix/tests/posix_fpathconf.phpt b/ext/posix/tests/posix_fpathconf.phpt index 91918d5901bb..f0cb749228a3 100644 --- a/ext/posix/tests/posix_fpathconf.phpt +++ b/ext/posix/tests/posix_fpathconf.phpt @@ -14,17 +14,16 @@ var_dump(posix_strerror(posix_errno())); try { posix_fpathconf("string arg", POSIX_PC_PATH_MAX); } catch (\TypeError $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $fd = fopen(__DIR__, "r"); var_dump(posix_fpathconf($fd, POSIX_PC_PATH_MAX)); fclose($fd); ?> --EXPECTF-- - Warning: posix_fpathconf(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d bool(false) bool(true) string(%d) "Bad file %r(descriptor|number)%r" -posix_fpathconf(): Argument #1 ($file_descriptor) must be of type int|resource, string given +TypeError: posix_fpathconf(): Argument #1 ($file_descriptor) must be of type int|resource, string given int(%d) diff --git a/ext/posix/tests/posix_getsid_error.phpt b/ext/posix/tests/posix_getsid_error.phpt index 68f168554997..39a1d146e481 100644 --- a/ext/posix/tests/posix_getsid_error.phpt +++ b/ext/posix/tests/posix_getsid_error.phpt @@ -12,8 +12,8 @@ posix try { posix_getsid(-1); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -posix_getsid(): Argument #1 ($process_id) must be between 0 and %d +ValueError: posix_getsid(): Argument #1 ($process_id) must be between 0 and %d diff --git a/ext/posix/tests/posix_kill_pidoverflow.phpt b/ext/posix/tests/posix_kill_pidoverflow.phpt index 0e8b8c7b7df1..9d70ef413d91 100644 --- a/ext/posix/tests/posix_kill_pidoverflow.phpt +++ b/ext/posix/tests/posix_kill_pidoverflow.phpt @@ -11,15 +11,15 @@ pcntl try { posix_kill(PHP_INT_MAX, SIGTERM); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { posix_kill(PHP_INT_MIN, SIGTERM); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -posix_kill(): Argument #1 ($process_id) must be between %i and %d -posix_kill(): Argument #1 ($process_id) must be between %i and %d +ValueError: posix_kill(): Argument #1 ($process_id) must be between %i and %d +ValueError: posix_kill(): Argument #1 ($process_id) must be between %i and %d diff --git a/ext/posix/tests/posix_pathconf.phpt b/ext/posix/tests/posix_pathconf.phpt index ba451c62df97..2cb92894bdc0 100644 --- a/ext/posix/tests/posix_pathconf.phpt +++ b/ext/posix/tests/posix_pathconf.phpt @@ -11,14 +11,14 @@ if (!function_exists("posix_pathconf")) die("skip only platforms with posix_path try { posix_pathconf('', POSIX_PC_PATH_MAX); } catch (\ValueError $e) { - echo $e->getMessage(). "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(posix_pathconf(str_repeat('non_existent', 4096), POSIX_PC_NAME_MAX)); var_dump(posix_errno() != 0); var_dump(posix_pathconf(sys_get_temp_dir(), POSIX_PC_PATH_MAX)); ?> --EXPECTF-- -posix_pathconf(): Argument #1 ($path) must not be empty +ValueError: posix_pathconf(): Argument #1 ($path) must not be empty bool(false) bool(true) int(%d) diff --git a/ext/posix/tests/posix_setpgid_error.phpt b/ext/posix/tests/posix_setpgid_error.phpt index 0d00dd87c60f..f1d2dc334c52 100644 --- a/ext/posix/tests/posix_setpgid_error.phpt +++ b/ext/posix/tests/posix_setpgid_error.phpt @@ -9,26 +9,26 @@ posix try { posix_setpgid(PHP_INT_MAX, 1); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { posix_setpgid(-2, 1); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { posix_setpgid(1, PHP_INT_MAX); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { posix_setpgid(1, -2); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- -posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d -posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d -posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d -posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d +ValueError: posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d +ValueError: posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d +ValueError: posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d +ValueError: posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d diff --git a/ext/posix/tests/posix_setrlimit.phpt b/ext/posix/tests/posix_setrlimit.phpt index 51638793f9d4..ea81a944e431 100644 --- a/ext/posix/tests/posix_setrlimit.phpt +++ b/ext/posix/tests/posix_setrlimit.phpt @@ -15,22 +15,22 @@ var_dump(posix_setrlimit(POSIX_RLIMIT_NOFILE, 128, 128)); try { posix_setrlimit(POSIX_RLIMIT_NOFILE, 129, 128); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { posix_setrlimit(POSIX_RLIMIT_NOFILE, -2, -1); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { posix_setrlimit(POSIX_RLIMIT_NOFILE, -1, -2); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- bool(true) -posix_setrlimit(): Argument #2 ($soft_limit) must be lower or equal to 128 -posix_setrlimit(): Argument #2 ($soft_limit) must be greater or equal to -1 -posix_setrlimit(): Argument #3 ($hard_limit) must be greater or equal to -1 +ValueError: posix_setrlimit(): Argument #2 ($soft_limit) must be lower or equal to 128 +ValueError: posix_setrlimit(): Argument #2 ($soft_limit) must be greater or equal to -1 +ValueError: posix_setrlimit(): Argument #3 ($hard_limit) must be greater or equal to -1 diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt index e35cd637a7fc..c00d02143e93 100644 --- a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt +++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt @@ -22,9 +22,9 @@ $process = proc_open('echo "foo";', $descriptors, $pipes); try { var_dump(posix_ttyname($process)); // wrong resource type } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(false) -posix_ttyname(): supplied resource is not a valid stream resource +TypeError: posix_ttyname(): supplied resource is not a valid stream resource From 86c8be2ad92314ce3298a9b83cb06441ae5535ae Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:46 +0000 Subject: [PATCH 12/23] ext/readline: applied fixers to improve test robustness --- .../tests/readline_callback_handler_install_001.phpt | 4 ++-- ext/readline/tests/readline_completion_function_001.phpt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/readline/tests/readline_callback_handler_install_001.phpt b/ext/readline/tests/readline_callback_handler_install_001.phpt index 543a57e657ef..d6602403ae05 100644 --- a/ext/readline/tests/readline_callback_handler_install_001.phpt +++ b/ext/readline/tests/readline_callback_handler_install_001.phpt @@ -17,10 +17,10 @@ var_dump(readline_callback_handler_install('testing: ', 'foo')); try { var_dump(readline_callback_handler_install('testing: ', 'foobar!')); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- testing: bool(true) -readline_callback_handler_install(): Argument #2 ($callback) must be a valid callback, function "foobar!" not found or invalid function name +TypeError: readline_callback_handler_install(): Argument #2 ($callback) must be a valid callback, function "foobar!" not found or invalid function name diff --git a/ext/readline/tests/readline_completion_function_001.phpt b/ext/readline/tests/readline_completion_function_001.phpt index a1d16a6774fc..31d502b7ec72 100644 --- a/ext/readline/tests/readline_completion_function_001.phpt +++ b/ext/readline/tests/readline_completion_function_001.phpt @@ -18,7 +18,7 @@ foreach ($data as $callback) { try { var_dump(readline_completion_function($callback)); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } } @@ -26,5 +26,5 @@ foreach ($data as $callback) { --EXPECT-- bool(true) bool(true) -readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given -readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given +TypeError: readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given +TypeError: readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given From d20188f17ed84538d26a81e1474dbd79a287ff3e Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:46 +0000 Subject: [PATCH 13/23] ext/shmop: applied fixers to improve test robustness --- ext/shmop/tests/001.phpt | 4 ++-- ext/shmop/tests/002.phpt | 26 +++++++++++++------------- ext/shmop/tests/gh9945.phpt | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt index 71e4065193dc..1805838d2781 100644 --- a/ext/shmop/tests/001.phpt +++ b/ext/shmop/tests/001.phpt @@ -42,7 +42,7 @@ shmop try { shmop_write($shm_id, $write_d1, $written); } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "shm open for read only: "; @@ -77,7 +77,7 @@ shm write test #1: ok data in memory is: test #1 of the shmop() extension shm open for read only: ok data in memory is: test #1 of the shmop() extension -Read-only segment cannot be written +Error: Read-only segment cannot be written shm open for read only: ok shm write test #2: ok data in memory is: test #1 of the shmop() extensiontest #2 append data to shared memory segment diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt index 56aea8fcdcb9..5372b0e95466 100644 --- a/ext/shmop/tests/002.phpt +++ b/ext/shmop/tests/002.phpt @@ -13,13 +13,13 @@ echo PHP_EOL, '## shmop_open function tests ##', PHP_EOL; try { shmop_open(1338, '', 0644, 1024); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { shmop_open(1338, 'b', 0644, 1024); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } // Warning outputs: Unable to attach or create shared memory segment @@ -29,14 +29,14 @@ var_dump(shmop_open(0, 'a', 0644, 1024)); try { shmop_open(0, 'a', 0644, 1024); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } //Shared memory segment size must be greater than zero try { shmop_open(1338, "c", 0666, 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo PHP_EOL, '## shmop_read function tests ##', PHP_EOL; @@ -45,7 +45,7 @@ $shm_id = shmop_open(1338, 'n', 0600, 1024); try { shmop_read($shm_id, -10, 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } shmop_delete($shm_id); @@ -54,7 +54,7 @@ $shm_id = shmop_open(1339, 'n', 0600, 1024); try { shmop_read($shm_id, 0, -10); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } shmop_delete($shm_id); @@ -64,24 +64,24 @@ $shm_id = shmop_open(1340, 'n', 0600, 1024); try { shmop_write($shm_id, 'text to try write', -10); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } shmop_delete($shm_id); ?> --EXPECTF-- ## shmop_open function tests ## -shmop_open(): Argument #2 ($mode) must be a valid access mode -shmop_open(): Argument #2 ($mode) must be a valid access mode +ValueError: shmop_open(): Argument #2 ($mode) must be a valid access mode +ValueError: shmop_open(): Argument #2 ($mode) must be a valid access mode Warning: shmop_open(): Unable to attach or create shared memory segment "%s" in %s on line %d bool(false) Warning: shmop_open(): Unable to attach or create shared memory segment "%s" in %s on line %d -shmop_open(): Argument #4 ($size) must be greater than 0 for the "c" and "n" access modes +ValueError: shmop_open(): Argument #4 ($size) must be greater than 0 for the "c" and "n" access modes ## shmop_read function tests ## -shmop_read(): Argument #2 ($offset) must be between 0 and the segment size -shmop_read(): Argument #3 ($size) is out of range +ValueError: shmop_read(): Argument #2 ($offset) must be between 0 and the segment size +ValueError: shmop_read(): Argument #3 ($size) is out of range ## shmop_write function tests ## -shmop_write(): Argument #3 ($offset) is out of range +ValueError: shmop_write(): Argument #3 ($offset) is out of range diff --git a/ext/shmop/tests/gh9945.phpt b/ext/shmop/tests/gh9945.phpt index f22f79149bfb..1bf117fc08dd 100644 --- a/ext/shmop/tests/gh9945.phpt +++ b/ext/shmop/tests/gh9945.phpt @@ -12,8 +12,8 @@ if (PHP_OS_FAMILY !== 'Linux' && PHP_OS_FAMILY !== 'Windows') die('skip only for try { shmop_open(0x100000000, '', 0644, 1); } catch (ValueError $exception) { - echo $exception->getMessage(), "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -shmop_open(): Argument #1 ($key) is out of range +ValueError: shmop_open(): Argument #1 ($key) is out of range From 1d4b05a5f3f10d5d3020cacf9e14430b61aaf302 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:47 +0000 Subject: [PATCH 14/23] ext/snmp: applied fixers to improve test robustness --- ext/snmp/tests/gh17330.phpt | 4 ++-- ext/snmp/tests/gh21336.phpt | 16 ++++++++-------- ext/snmp/tests/gh21682.phpt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/snmp/tests/gh17330.phpt b/ext/snmp/tests/gh17330.phpt index a6f077a9c860..898b0357fcd9 100644 --- a/ext/snmp/tests/gh17330.phpt +++ b/ext/snmp/tests/gh17330.phpt @@ -11,8 +11,8 @@ $session->close(); try { $session->setSecurity('authPriv', 'MD5', '', 'AES', ''); } catch(Error $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -Invalid or uninitialized SNMP object +Error: Invalid or uninitialized SNMP object diff --git a/ext/snmp/tests/gh21336.phpt b/ext/snmp/tests/gh21336.phpt index a4070136e550..745bcb27652c 100644 --- a/ext/snmp/tests/gh21336.phpt +++ b/ext/snmp/tests/gh21336.phpt @@ -10,32 +10,32 @@ $session = new SNMP(SNMP::VERSION_3, 'localhost', 'user'); try { $session->setSecurity('authPriv'); } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // auth passphrase NULL try { $session->setSecurity('authNoPriv', 'MD5'); } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // priv protocol NULL try { $session->setSecurity('authPriv', 'MD5', 'test12345'); } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // priv passphrase NULL try { $session->setSecurity('authPriv', 'MD5', 'test12345', 'AES'); } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -SNMP::setSecurity(): Argument #2 ($authProtocol) cannot be null when security level is "authNoPriv" or "authPriv" -SNMP::setSecurity(): Argument #3 ($authPassphrase) cannot be null when security level is "authNoPriv" or "authPriv" -SNMP::setSecurity(): Argument #4 ($privacyProtocol) cannot be null when security level is "authPriv" -SNMP::setSecurity(): Argument #5 ($privacyPassphrase) cannot be null when security level is "authPriv" +ValueError: SNMP::setSecurity(): Argument #2 ($authProtocol) cannot be null when security level is "authNoPriv" or "authPriv" +ValueError: SNMP::setSecurity(): Argument #3 ($authPassphrase) cannot be null when security level is "authNoPriv" or "authPriv" +ValueError: SNMP::setSecurity(): Argument #4 ($privacyProtocol) cannot be null when security level is "authPriv" +ValueError: SNMP::setSecurity(): Argument #5 ($privacyPassphrase) cannot be null when security level is "authPriv" diff --git a/ext/snmp/tests/gh21682.phpt b/ext/snmp/tests/gh21682.phpt index 36b455035935..584e6b784c5e 100644 --- a/ext/snmp/tests/gh21682.phpt +++ b/ext/snmp/tests/gh21682.phpt @@ -9,7 +9,7 @@ try { serialize($s); echo "ERROR: should have thrown\n"; } catch (\Exception $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $s->close(); ?> From 675a76f507045555714d034f3a9149bf0b26ab8e Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:47 +0000 Subject: [PATCH 15/23] ext/sodium: applied fixers to improve test robustness --- ext/sodium/tests/bug78114.phpt | 4 ++-- ext/sodium/tests/crypto_auth.phpt | 4 ++-- ext/sodium/tests/crypto_box.phpt | 4 ++-- .../tests/crypto_core_ristretto255.phpt | 4 ++-- .../tests/crypto_scalarmult_ristretto255.phpt | 12 +++++------ ext/sodium/tests/crypto_stream_xchacha20.phpt | 20 +++++++++---------- ext/sodium/tests/inc_add.phpt | 8 ++++---- .../tests/pwhash_memlimit_below_min.phpt | 8 ++++---- ...ed25519_pk_to_curve25519_failure_leak.phpt | 4 ++-- ext/sodium/tests/utils.phpt | 4 ++-- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ext/sodium/tests/bug78114.phpt b/ext/sodium/tests/bug78114.phpt index b988c09ec23f..cea157e99655 100644 --- a/ext/sodium/tests/bug78114.phpt +++ b/ext/sodium/tests/bug78114.phpt @@ -7,8 +7,8 @@ sodium try { eval('sodium_bin2hex();'); } catch (Throwable $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } ?> --EXPECT-- -sodium_bin2hex() expects exactly 1 argument, 0 given +ArgumentCountError: sodium_bin2hex() expects exactly 1 argument, 0 given diff --git a/ext/sodium/tests/crypto_auth.phpt b/ext/sodium/tests/crypto_auth.phpt index 8f262414beb8..20b7ba7ebade 100644 --- a/ext/sodium/tests/crypto_auth.phpt +++ b/ext/sodium/tests/crypto_auth.phpt @@ -16,7 +16,7 @@ try { $mac = sodium_crypto_auth($msg, $bad_key); echo 'Fail!', PHP_EOL; } catch (SodiumException $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } // Flip the first bit @@ -41,7 +41,7 @@ var_dump(sodium_crypto_auth_verify($badmac, $msg, $key)); ?> --EXPECT-- bool(true) -sodium_crypto_auth(): Argument #2 ($key) must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes long +SodiumException: sodium_crypto_auth(): Argument #2 ($key) must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes long bool(false) bool(false) bool(false) diff --git a/ext/sodium/tests/crypto_box.phpt b/ext/sodium/tests/crypto_box.phpt index f77ec1601cf3..82a392d3260c 100644 --- a/ext/sodium/tests/crypto_box.phpt +++ b/ext/sodium/tests/crypto_box.phpt @@ -49,7 +49,7 @@ try { substr($alice_to_bob_kp, 1) ); } catch (SodiumException $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } sodium_memzero($alice_box_kp); @@ -142,7 +142,7 @@ bool(true) bool(true) bool(true) bool(true) -sodium_crypto_box(): Argument #3 ($key_pair) must be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes long +SodiumException: sodium_crypto_box(): Argument #3 ($key_pair) must be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes long bool(true) string(17) "Hi, this is Alice" string(21) "Hi Alice! This is Bob" diff --git a/ext/sodium/tests/crypto_core_ristretto255.phpt b/ext/sodium/tests/crypto_core_ristretto255.phpt index f1d20fd22aec..65aa52f3eead 100644 --- a/ext/sodium/tests/crypto_core_ristretto255.phpt +++ b/ext/sodium/tests/crypto_core_ristretto255.phpt @@ -78,7 +78,7 @@ $s = sodium_crypto_core_ristretto255_random(); try { $multL = sodium_crypto_scalarmult_ristretto255($s, $L); } catch (SodiumException $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $s2 = sodium_crypto_scalarmult_ristretto255($r, $s); @@ -128,6 +128,6 @@ bool(false) bool(false) string(64) "3066f82a1a747d45120d1740f14358531a8f04bbffe6a819f86dfe50f44a0a46" bool(true) -Result is identity element +SodiumException: Result is identity element bool(true) bool(true) diff --git a/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt b/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt index 0a21d64075dc..3568019cce7c 100644 --- a/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt +++ b/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt @@ -14,12 +14,12 @@ $n = str_repeat("\0", SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES); try { $p = sodium_crypto_scalarmult_ristretto255_base($n); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { $p2 = sodium_crypto_scalarmult_ristretto255($n, $b); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } for ($i = 1; $i < 16; $i++) { @@ -33,13 +33,13 @@ for ($i = 1; $i < 16; $i++) { try { sodium_crypto_scalarmult(substr($n, 1), $p); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -sodium_crypto_scalarmult_ristretto255_base(): Argument #1 ($n) must not be zero -Result is identity element +SodiumException: sodium_crypto_scalarmult_ristretto255_base(): Argument #1 ($n) must not be zero +SodiumException: Result is identity element string(64) "e2f2ae0a6abc4e71a884a961c500515f58e30b6aa582dd8db6a65945e08d2d76" string(64) "6a493210f7499cd17fecb510ae0cea23a110e8d5b901f8acadd3095c73a3b919" string(64) "94741f5d5d52755ece4f23f044ee27d5d1ea1e2bd196b462166b16152a9d0259" @@ -55,4 +55,4 @@ string(64) "e4549ee16b9aa03099ca208c67adafcafa4c3f3e4e5303de6026e3ca8ff84460" string(64) "aa52e000df2e16f55fb1032fc33bc42742dad6bd5a8fc0be0167436c5948501f" string(64) "46376b80f409b29dc2b5f6f0c52591990896e5716f41477cd30085ab7f10301e" string(64) "e0c418f7c8d9c4cdd7395b93ea124f3ad99021bb681dfc3302a9d99a2e53e64e" -sodium_crypto_scalarmult(): Argument #1 ($n) must be SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes long +SodiumException: sodium_crypto_scalarmult(): Argument #1 ($n) must be SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes long diff --git a/ext/sodium/tests/crypto_stream_xchacha20.phpt b/ext/sodium/tests/crypto_stream_xchacha20.phpt index 466734853d70..0db0a4a487c4 100644 --- a/ext/sodium/tests/crypto_stream_xchacha20.phpt +++ b/ext/sodium/tests/crypto_stream_xchacha20.phpt @@ -53,27 +53,27 @@ var_dump($stream7_unified === $stream7_concat); try { sodium_crypto_stream_xchacha20(-1, $nonce, $key); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { sodium_crypto_stream_xchacha20($len, substr($nonce, 1), $key); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { sodium_crypto_stream_xchacha20($len, $nonce, substr($key, 1)); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { sodium_crypto_stream_xchacha20_xor($stream, substr($nonce, 1), $key); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { sodium_crypto_stream_xchacha20_xor($stream, $nonce, substr($key, 1)); } catch (SodiumException $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> @@ -89,8 +89,8 @@ bool(true) bool(true) int(128) bool(true) -sodium_crypto_stream_xchacha20(): Argument #1 ($length) must be greater than 0 -sodium_crypto_stream_xchacha20(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long -sodium_crypto_stream_xchacha20(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long -sodium_crypto_stream_xchacha20_xor(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long -sodium_crypto_stream_xchacha20_xor(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long +SodiumException: sodium_crypto_stream_xchacha20(): Argument #1 ($length) must be greater than 0 +SodiumException: sodium_crypto_stream_xchacha20(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long +SodiumException: sodium_crypto_stream_xchacha20(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long +SodiumException: sodium_crypto_stream_xchacha20_xor(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long +SodiumException: sodium_crypto_stream_xchacha20_xor(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long diff --git a/ext/sodium/tests/inc_add.phpt b/ext/sodium/tests/inc_add.phpt index 7652cf851eb2..60dae7db9f75 100644 --- a/ext/sodium/tests/inc_add.phpt +++ b/ext/sodium/tests/inc_add.phpt @@ -9,7 +9,7 @@ $notStr = 123; try { sodium_increment($notStr); } catch (SodiumException $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $str = "abc"; @@ -28,7 +28,7 @@ $notStr = 123; try { sodium_add($notStr, $addStr); } catch (SodiumException $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $str = "abc"; @@ -43,12 +43,12 @@ var_dump($str, $str2); ?> --EXPECT-- -a PHP string is required +SodiumException: a PHP string is required string(3) "bbc" string(3) "abc" string(3) "bbc" string(3) "abc" -PHP strings are required +SodiumException: PHP strings are required string(3) "cbc" string(3) "abc" string(3) "cbc" diff --git a/ext/sodium/tests/pwhash_memlimit_below_min.phpt b/ext/sodium/tests/pwhash_memlimit_below_min.phpt index 8913afb382f0..68fe135775c9 100644 --- a/ext/sodium/tests/pwhash_memlimit_below_min.phpt +++ b/ext/sodium/tests/pwhash_memlimit_below_min.phpt @@ -13,15 +13,15 @@ $salt = str_repeat("a", SODIUM_CRYPTO_PWHASH_SALTBYTES); try { sodium_crypto_pwhash(32, "password", $salt, SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, 1); } catch (\ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { sodium_crypto_pwhash_str("password", SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, 1); } catch (\ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- -sodium_crypto_pwhash(): Argument #5 ($memlimit) must be greater than or equal to %d -sodium_crypto_pwhash_str(): Argument #3 ($memlimit) must be greater than or equal to %d +ValueError: sodium_crypto_pwhash(): Argument #5 ($memlimit) must be greater than or equal to %d +ValueError: sodium_crypto_pwhash_str(): Argument #3 ($memlimit) must be greater than or equal to %d diff --git a/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt b/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt index 1e4e74eecbe0..c2485cc5e780 100644 --- a/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt +++ b/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt @@ -8,9 +8,9 @@ sodium try { sodium_crypto_sign_ed25519_pk_to_curve25519(str_repeat("\x00", SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES)); } catch (SodiumException $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -conversion failed +SodiumException: conversion failed diff --git a/ext/sodium/tests/utils.phpt b/ext/sodium/tests/utils.phpt index 66969a60bdf4..f60aa4dbd082 100644 --- a/ext/sodium/tests/utils.phpt +++ b/ext/sodium/tests/utils.phpt @@ -102,7 +102,7 @@ function sodium_foo() try { sodium_foo(); } catch (SodiumException $ex) { - var_dump($ex->getMessage()); + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> @@ -126,4 +126,4 @@ string(25) "base64("O1R") case passed" string(24) "base64("O1") case passed" string(23) "base64("O") case passed" string(4) "abcd" -string(4) "test" +SodiumException: test From 57f60607ab8a7880ad025a6366254d26de226cb2 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:47 +0000 Subject: [PATCH 16/23] ext/sqlite3: applied fixers to improve test robustness --- ext/sqlite3/tests/bug66550.phpt | 4 ++-- ext/sqlite3/tests/bug68760.phpt | 2 +- ext/sqlite3/tests/bug72668.phpt | 8 +++++--- ext/sqlite3/tests/bug77051.phpt | 2 +- ext/sqlite3/tests/gh9032.phpt | 4 ++-- ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt | 2 +- ext/sqlite3/tests/sqlite3_02_open.phpt | 4 ++-- .../tests/sqlite3_12_unfinalized_stmt_cleanup.phpt | 4 ++-- ext/sqlite3/tests/sqlite3_31_open.phpt | 4 ++-- .../sqlite3_33_createAggregate_notcallable.phpt | 8 ++++---- .../tests/sqlite3_33_load_extension_param.phpt | 4 ++-- .../tests/sqlite3_34_load_extension_ext_dir.phpt | 2 +- ext/sqlite3/tests/sqlite3_38_backup.phpt | 2 +- ext/sqlite3/tests/sqlite3_38_extended_error.phpt | 1 - ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt | 1 - ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt | 12 ++++++------ ext/sqlite3/tests/sqlite3_enable_exceptions.phpt | 4 ++-- ext/sqlite3/tests/sqlite3_explain.phpt | 8 ++++---- .../tests/sqlite3_trampoline_setauthorizer.phpt | 4 ++-- .../tests/sqlite3_trampoline_setauthorizer_null.phpt | 2 +- 20 files changed, 41 insertions(+), 41 deletions(-) diff --git a/ext/sqlite3/tests/bug66550.phpt b/ext/sqlite3/tests/bug66550.phpt index 60477a0b17ae..11548906a5b1 100644 --- a/ext/sqlite3/tests/bug66550.phpt +++ b/ext/sqlite3/tests/bug66550.phpt @@ -16,8 +16,8 @@ $db->close(); try { $stmt->reset(); } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -The SQLite3 object has not been correctly initialised or is already closed +Error: The SQLite3 object has not been correctly initialised or is already closed diff --git a/ext/sqlite3/tests/bug68760.phpt b/ext/sqlite3/tests/bug68760.phpt index c6cc9ed3b1e2..cfcc7080b9f0 100644 --- a/ext/sqlite3/tests/bug68760.phpt +++ b/ext/sqlite3/tests/bug68760.phpt @@ -24,7 +24,7 @@ try { $db->close(); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- diff --git a/ext/sqlite3/tests/bug72668.phpt b/ext/sqlite3/tests/bug72668.phpt index 7f33338eb5e6..551ec18cae0c 100644 --- a/ext/sqlite3/tests/bug72668.phpt +++ b/ext/sqlite3/tests/bug72668.phpt @@ -16,14 +16,14 @@ try { var_dump($result); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { $result = $db->querySingle("SELECT my_udf_md5('test')"); var_dump($result); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $statement = $db->prepare("SELECT my_udf_md5('test')"); try { @@ -31,10 +31,12 @@ try { var_dump($result); } catch(\Exception $e) { - echo "Exception: ".$e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- Exception: test exception + Exception: test exception + Exception: test exception diff --git a/ext/sqlite3/tests/bug77051.phpt b/ext/sqlite3/tests/bug77051.phpt index 7b44516b7fdf..7cba3ca8c968 100644 --- a/ext/sqlite3/tests/bug77051.phpt +++ b/ext/sqlite3/tests/bug77051.phpt @@ -81,4 +81,4 @@ array(3) { string(4) "TEST" [2]=> string(3) "!!!" -} \ No newline at end of file +} diff --git a/ext/sqlite3/tests/gh9032.phpt b/ext/sqlite3/tests/gh9032.phpt index 34ca992ab26b..f479cbdfd200 100644 --- a/ext/sqlite3/tests/gh9032.phpt +++ b/ext/sqlite3/tests/gh9032.phpt @@ -18,9 +18,9 @@ try { $st->execute(); var_dump($db->exec('create table db2.r (id int)')); } catch (SQLite3Exception $ex) { - echo $ex->getMessage(), PHP_EOL; + echo $ex::class, ': ', $ex->getMessage(), PHP_EOL; } ?> --EXPECT-- bool(true) -Unable to prepare statement: not authorized +SQLite3Exception: Unable to prepare statement: not authorized diff --git a/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt b/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt index 49d66a1accf5..25fb24e53170 100644 --- a/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt +++ b/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt @@ -17,7 +17,7 @@ foreach ($cases as $in) { SQLite3::escapeString($in); echo "FAIL: no exception for ", bin2hex($in), "\n"; } catch (ValueError $e) { - echo "ValueError: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/ext/sqlite3/tests/sqlite3_02_open.phpt b/ext/sqlite3/tests/sqlite3_02_open.phpt index 128e8c1b2484..a292bc1e7c74 100644 --- a/ext/sqlite3/tests/sqlite3_02_open.phpt +++ b/ext/sqlite3/tests/sqlite3_02_open.phpt @@ -11,9 +11,9 @@ sqlite3 try { $db = new SQLite3(); } catch (TypeError $e) { - var_dump($e->getMessage()); + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -string(59) "SQLite3::__construct() expects at least 1 argument, 0 given" +ArgumentCountError: SQLite3::__construct() expects at least 1 argument, 0 given diff --git a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt index 67037e22695e..777aaffe1190 100644 --- a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt +++ b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt @@ -30,7 +30,7 @@ echo "Check db was closed\n"; try { var_dump($results->numColumns()); } catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } echo "Done\n"; ?> @@ -50,5 +50,5 @@ array(2) { Closing database bool(true) Check db was closed -The SQLite3Result object has not been correctly initialised or is already closed +Error: The SQLite3Result object has not been correctly initialised or is already closed Done diff --git a/ext/sqlite3/tests/sqlite3_31_open.phpt b/ext/sqlite3/tests/sqlite3_31_open.phpt index 3b5705cb98df..3553c1db3ce5 100644 --- a/ext/sqlite3/tests/sqlite3_31_open.phpt +++ b/ext/sqlite3/tests/sqlite3_31_open.phpt @@ -12,11 +12,11 @@ try { $db = new SQLite3(__DIR__ . '/db1.db'); $db->open(__DIR__ . '/db1.db'); } catch (Exception $ex) { - var_dump($ex->getMessage()); + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --CLEAN-- --EXPECT-- -string(29) "Already initialised DB Object" +Exception: Already initialised DB Object diff --git a/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt b/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt index 497c54062dcb..7af587f639ba 100644 --- a/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt +++ b/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt @@ -16,13 +16,13 @@ $db = new SQLite3(':memory:'); try { $db->createAggregate('TESTAGGREGATE', 'aggregate_test_step', 'aggregate_final'); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $db->createAggregate('TESTAGGREGATE2', 'aggregate_step', 'aggregate_test_final'); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump($db->createAggregate ('TESTAGGREGATE3', 'aggregate_step', 'aggregate_final')); @@ -32,7 +32,7 @@ $db->close(); echo "Done" ?> --EXPECT-- -SQLite3::createAggregate(): Argument #2 ($stepCallback) must be a valid callback, function "aggregate_test_step" not found or invalid function name -SQLite3::createAggregate(): Argument #3 ($finalCallback) must be a valid callback, function "aggregate_test_final" not found or invalid function name +TypeError: SQLite3::createAggregate(): Argument #2 ($stepCallback) must be a valid callback, function "aggregate_test_step" not found or invalid function name +TypeError: SQLite3::createAggregate(): Argument #3 ($finalCallback) must be a valid callback, function "aggregate_test_final" not found or invalid function name bool(true) Done diff --git a/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt b/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt index 0be7469c8944..57f6e5f380cf 100644 --- a/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt +++ b/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt @@ -21,9 +21,9 @@ $db = new SQLite3(':memory:'); try { $db->loadExtension(""); } catch (\Throwable $ex) { - var_dump($ex->getMessage()); + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECTF-- -string(63) "SQLite3::loadExtension(): Argument #1 ($name) must not be empty" +ValueError: SQLite3::loadExtension(): Argument #1 ($name) must not be empty diff --git a/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt b/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt index e23d9a8dad84..252801302619 100644 --- a/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt +++ b/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt @@ -19,7 +19,7 @@ $db = new SQLite3(':memory:'); try { $db->loadExtension(""); } catch (Extension $ex) { - var_dump($ex->getMessage()); + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> diff --git a/ext/sqlite3/tests/sqlite3_38_backup.phpt b/ext/sqlite3/tests/sqlite3_38_backup.phpt index 54ca9e95c231..e97ce758b427 100644 --- a/ext/sqlite3/tests/sqlite3_38_backup.phpt +++ b/ext/sqlite3/tests/sqlite3_38_backup.phpt @@ -55,4 +55,4 @@ bool(true) Backup to DB2 (should fail) Warning: SQLite3::backup(): Backup failed: source database is busy in %s on line %d -bool(false) \ No newline at end of file +bool(false) diff --git a/ext/sqlite3/tests/sqlite3_38_extended_error.phpt b/ext/sqlite3/tests/sqlite3_38_extended_error.phpt index 433e1efce047..7647980d074f 100644 --- a/ext/sqlite3/tests/sqlite3_38_extended_error.phpt +++ b/ext/sqlite3/tests/sqlite3_38_extended_error.phpt @@ -33,4 +33,3 @@ Second Extended Error Code: 1555 Closing database bool(true) Done - diff --git a/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt b/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt index 135c1cdd1095..3e3d290c130b 100644 --- a/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt +++ b/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt @@ -40,4 +40,3 @@ Third (Extended) Error Code: 1555 Closing database bool(true) Done - diff --git a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt index a4f30040334c..63d50714715a 100644 --- a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt +++ b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt @@ -23,7 +23,7 @@ try { // This one should fail var_dump($db->querySingle('CREATE TABLE test (a, b);')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } // Test disabling the authorizer @@ -53,7 +53,7 @@ $db->setAuthorizer(function () { try { var_dump($db->querySingle('SELECT 1;')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; echo $e->getPrevious()->getMessage() . "\n"; } @@ -64,14 +64,14 @@ $db->setAuthorizer(function () { try { var_dump($db->querySingle('SELECT 1;')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; echo $e->getPrevious()->getMessage() . "\n"; } ?> --EXPECT-- int(1) -Unable to prepare statement: not authorized +SQLite3Exception: Unable to prepare statement: not authorized bool(true) int(42) string(6) "SELECT" @@ -98,7 +98,7 @@ string(28) "sqlite_master,rootpage,main," string(4) "READ" string(28) "sqlite_master,rootpage,main," bool(true) -Unable to prepare statement: not authorized +SQLite3Exception: Unable to prepare statement: not authorized The authorizer callback returned an invalid type: expected int -Unable to prepare statement: not authorized +SQLite3Exception: Unable to prepare statement: not authorized The authorizer callback returned an invalid value: 4200 diff --git a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt index a072f31c9476..4669f57ded16 100644 --- a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt +++ b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt @@ -13,7 +13,7 @@ var_dump($db->enableExceptions(true)); try{ $db->query("SELECT * FROM non_existent_table"); } catch(Exception $e) { - echo $e->getMessage().PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump($db->enableExceptions(false)); $db->query("SELECT * FROM non_existent_table"); @@ -23,7 +23,7 @@ echo "Done\n"; ?> --EXPECTF-- bool(false) -no such table: non_existent_table +SQLite3Exception: no such table: non_existent_table Deprecated: SQLite3::enableExceptions(): Use of warnings for SQLite3 is deprecated in %s bool(true) diff --git a/ext/sqlite3/tests/sqlite3_explain.phpt b/ext/sqlite3/tests/sqlite3_explain.phpt index 1f9d4fc940e4..710e6a51fbec 100644 --- a/ext/sqlite3/tests/sqlite3_explain.phpt +++ b/ext/sqlite3/tests/sqlite3_explain.phpt @@ -41,13 +41,13 @@ var_dump($result); try { $stmts->setExplain(-1); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { $stmts->setExplain(256); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump($stmts->explain() == Sqlite3Stmt::EXPLAIN_MODE_PREPARED); @@ -385,6 +385,6 @@ array(2) { string(13) "second_insert" } } -SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants -SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants +ValueError: SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants +ValueError: SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants bool(true) diff --git a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt index 9a89d36f8e68..9793dcc230e1 100644 --- a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt +++ b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt @@ -30,7 +30,7 @@ try { // This one should fail var_dump($db->querySingle('CREATE TABLE test (a, b);')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -38,4 +38,4 @@ try { Trampoline for authorizer int(1) Trampoline for authorizer -Unable to prepare statement: not authorized +SQLite3Exception: Unable to prepare statement: not authorized diff --git a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt index 2cea279f077e..d0fbc16a7d24 100644 --- a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt +++ b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt @@ -17,7 +17,7 @@ try { // This one should fail var_dump($db->querySingle('CREATE TABLE test (a, b);')); } catch (\Exception $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> From 32bdb751dc323017a444d4d992c44ac9a1fc5ea4 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:48 +0000 Subject: [PATCH 17/23] ext/sysvmsg: applied fixers to improve test robustness --- ext/sysvmsg/tests/005.phpt | 6 +++--- ext/sysvmsg/tests/006.phpt | 6 +++--- ext/sysvmsg/tests/gh16592.phpt | 4 ++-- ext/sysvmsg/tests/gh9945.phpt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/sysvmsg/tests/005.phpt b/ext/sysvmsg/tests/005.phpt index ec36c85b75ff..a38761ebffb8 100644 --- a/ext/sysvmsg/tests/005.phpt +++ b/ext/sysvmsg/tests/005.phpt @@ -31,7 +31,7 @@ foreach ($tests as $i => $q) { try { msg_receive($q, 0, $null, 0, $msg); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(msg_send($q, 1, 'foo', true, true, $errno)); @@ -46,7 +46,7 @@ bool(false) bool(false) bool(false) bool(true) -msg_receive(): Argument #4 ($max_message_size) must be greater than 0 +ValueError: msg_receive(): Argument #4 ($max_message_size) must be greater than 0 Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d bool(false) @@ -56,7 +56,7 @@ bool(false) bool(false) bool(false) bool(true) -msg_receive(): Argument #4 ($max_message_size) must be greater than 0 +ValueError: msg_receive(): Argument #4 ($max_message_size) must be greater than 0 Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d bool(false) diff --git a/ext/sysvmsg/tests/006.phpt b/ext/sysvmsg/tests/006.phpt index ae608c6c1fbf..3e59d4a5cd86 100644 --- a/ext/sysvmsg/tests/006.phpt +++ b/ext/sysvmsg/tests/006.phpt @@ -14,7 +14,7 @@ foreach ($tests as $elem) { try { var_dump(msg_send($queue, 1, $elem, false)); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } unset($msg); @@ -57,12 +57,12 @@ bool(true) bool(true) bool(false) Sending/receiving '': -msg_send(): Argument #3 ($message) must be of type string|int|float|bool, null given +TypeError: msg_send(): Argument #3 ($message) must be of type string|int|float|bool, null given bool(false) bool(true) bool(false) Sending/receiving 'Array': -msg_send(): Argument #3 ($message) must be of type string|int|float|bool, array given +TypeError: msg_send(): Argument #3 ($message) must be of type string|int|float|bool, array given bool(false) bool(false) bool(false) diff --git a/ext/sysvmsg/tests/gh16592.phpt b/ext/sysvmsg/tests/gh16592.phpt index d48927b4dfee..57393e360fe6 100644 --- a/ext/sysvmsg/tests/gh16592.phpt +++ b/ext/sysvmsg/tests/gh16592.phpt @@ -13,10 +13,10 @@ $q = msg_get_queue(0, 0600); try { msg_send($q, 1, new Test, true); } catch (\TypeError $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } finally { msg_remove_queue($q); } ?> --EXPECT-- -Test::__serialize() must return an array +TypeError: Test::__serialize() must return an array diff --git a/ext/sysvmsg/tests/gh9945.phpt b/ext/sysvmsg/tests/gh9945.phpt index e346bde9fc29..6f6158e81c35 100644 --- a/ext/sysvmsg/tests/gh9945.phpt +++ b/ext/sysvmsg/tests/gh9945.phpt @@ -12,13 +12,13 @@ if (PHP_OS_FAMILY !== 'Linux') die('skip only for platforms with 32-bit key_t'); try { msg_queue_exists(0x100000000); } catch (ValueError $exception) { - echo $exception::class, ": ", $exception->getMessage(), "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { msg_get_queue(0x100000000); } catch (ValueError $exception) { - echo $exception::class, ": ", $exception->getMessage(), "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- From a78699d57e8fc2b4dd47cdf61e93774bc4c9d9f2 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:48 +0000 Subject: [PATCH 18/23] ext/sysvsem: applied fixers to improve test robustness --- ext/sysvsem/tests/gh9945.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/sysvsem/tests/gh9945.phpt b/ext/sysvsem/tests/gh9945.phpt index a7959eb21563..57791692b523 100644 --- a/ext/sysvsem/tests/gh9945.phpt +++ b/ext/sysvsem/tests/gh9945.phpt @@ -12,7 +12,7 @@ if (PHP_OS_FAMILY !== 'Linux') die('skip only for platforms with 32-bit key_t'); try { sem_get(0x100000000); } catch (ValueError $exception) { - echo $exception::class, ": ", $exception->getMessage(), "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- From 8542279806dd62c1038a78a4942ee953cc99adbe Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:48 +0000 Subject: [PATCH 19/23] ext/sysvshm: applied fixers to improve test robustness --- ext/sysvshm/tests/001.phpt | 12 ++++++------ ext/sysvshm/tests/002.phpt | 20 ++++++++++---------- ext/sysvshm/tests/003.phpt | 8 ++++---- ext/sysvshm/tests/006.phpt | 2 +- ext/sysvshm/tests/007.phpt | 4 ++-- ext/sysvshm/tests/gh16591.phpt | 4 ++-- ext/sysvshm/tests/gh9945.phpt | 4 ++-- ext/sysvshm/tests/serialize_exception.phpt | 4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ext/sysvshm/tests/001.phpt b/ext/sysvshm/tests/001.phpt index 10b258da2d0b..f97ff5eb0b36 100644 --- a/ext/sysvshm/tests/001.phpt +++ b/ext/sysvshm/tests/001.phpt @@ -13,19 +13,19 @@ if (!function_exists('ftok')){ print 'skip'; } try { ftok("",""); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { ftok(-1, -1); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { ftok("qwertyu","qwertyu"); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(ftok("nonexistentfile","q")); @@ -35,9 +35,9 @@ var_dump(ftok(__FILE__,"q")); echo "Done\n"; ?> --EXPECTF-- -ftok(): Argument #1 ($filename) must not be empty -ftok(): Argument #2 ($project_id) must be a single character -ftok(): Argument #2 ($project_id) must be a single character +ValueError: ftok(): Argument #1 ($filename) must not be empty +ValueError: ftok(): Argument #2 ($project_id) must be a single character +ValueError: ftok(): Argument #2 ($project_id) must be a single character Warning: ftok(): ftok() failed - No such file or directory in %s on line %d int(-1) diff --git a/ext/sysvshm/tests/002.phpt b/ext/sysvshm/tests/002.phpt index d9a91c580e93..2521a388cfd4 100644 --- a/ext/sysvshm/tests/002.phpt +++ b/ext/sysvshm/tests/002.phpt @@ -15,31 +15,31 @@ $key = ftok(__FILE__, 't'); try { shm_attach(-1, 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { shm_attach(0, -1); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { shm_attach(123, -1); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { shm_attach($key, -1); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { shm_attach($key, 0); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump($s = shm_attach($key, 1024)); @@ -57,11 +57,11 @@ shm_remove($s); echo "Done\n"; ?> --EXPECTF-- -shm_attach(): Argument #2 ($size) must be greater than 0 -shm_attach(): Argument #2 ($size) must be greater than 0 -shm_attach(): Argument #2 ($size) must be greater than 0 -shm_attach(): Argument #2 ($size) must be greater than 0 -shm_attach(): Argument #2 ($size) must be greater than 0 +ValueError: shm_attach(): Argument #2 ($size) must be greater than 0 +ValueError: shm_attach(): Argument #2 ($size) must be greater than 0 +ValueError: shm_attach(): Argument #2 ($size) must be greater than 0 +ValueError: shm_attach(): Argument #2 ($size) must be greater than 0 +ValueError: shm_attach(): Argument #2 ($size) must be greater than 0 object(SysvSharedMemory)#%d (0) { } object(SysvSharedMemory)#%d (0) { diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt index 1d842fb92759..4fbdb918966d 100644 --- a/ext/sysvshm/tests/003.phpt +++ b/ext/sysvshm/tests/003.phpt @@ -18,13 +18,13 @@ var_dump(shm_detach($s)); try { shm_detach($s); } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { shm_remove($s); } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; @@ -39,6 +39,6 @@ shm_remove($s); ?> --EXPECT-- bool(true) -Shared memory block has already been destroyed -Shared memory block has already been destroyed +Error: Shared memory block has already been destroyed +Error: Shared memory block has already been destroyed Done diff --git a/ext/sysvshm/tests/006.phpt b/ext/sysvshm/tests/006.phpt index edbf9288acce..35da41adc54b 100644 --- a/ext/sysvshm/tests/006.phpt +++ b/ext/sysvshm/tests/006.phpt @@ -16,7 +16,7 @@ $s = shm_attach($key, 1024); try { shm_put_var($s, 1, "test string"); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } var_dump(shm_remove_var($s, -10)); diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt index 544c39deb00a..da0ebfb89e6f 100644 --- a/ext/sysvshm/tests/007.phpt +++ b/ext/sysvshm/tests/007.phpt @@ -19,12 +19,12 @@ shm_detach($s); try { shm_remove($s); } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECT-- bool(true) -Shared memory block has already been destroyed +Error: Shared memory block has already been destroyed Done diff --git a/ext/sysvshm/tests/gh16591.phpt b/ext/sysvshm/tests/gh16591.phpt index fb1c58168f57..031b20956720 100644 --- a/ext/sysvshm/tests/gh16591.phpt +++ b/ext/sysvshm/tests/gh16591.phpt @@ -19,11 +19,11 @@ $cleanup = shm_attach($key); try { shm_put_var($mem, 1, new C); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } finally { shm_remove($cleanup); } ?> --EXPECT-- -Shared memory block has been destroyed by the serialization function +Error: Shared memory block has been destroyed by the serialization function diff --git a/ext/sysvshm/tests/gh9945.phpt b/ext/sysvshm/tests/gh9945.phpt index 8185d39b0981..cc53e5e1eafa 100644 --- a/ext/sysvshm/tests/gh9945.phpt +++ b/ext/sysvshm/tests/gh9945.phpt @@ -12,8 +12,8 @@ if (PHP_OS_FAMILY !== 'Linux' && PHP_OS_FAMILY !== 'Windows') die('skip only for try { shm_attach(0x100000000, 0); } catch (ValueError $exception) { - echo $exception->getMessage(), "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -shm_attach(): Argument #1 ($key) is out of range +ValueError: shm_attach(): Argument #1 ($key) is out of range diff --git a/ext/sysvshm/tests/serialize_exception.phpt b/ext/sysvshm/tests/serialize_exception.phpt index aae237e0fb38..a311600ec223 100644 --- a/ext/sysvshm/tests/serialize_exception.phpt +++ b/ext/sysvshm/tests/serialize_exception.phpt @@ -17,11 +17,11 @@ class Test { try { shm_put_var($s, 1, new Test); } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } shm_remove($s); ?> --EXPECT-- -no +Error: no From 2d8fe81dc7cde341bbe641eecc8654f4549224b9 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:48 +0000 Subject: [PATCH 20/23] ext/tidy: applied fixers to improve test robustness --- ext/tidy/tests/007.phpt | 8 ++--- ext/tidy/tests/019.phpt | 8 ++--- ext/tidy/tests/021.phpt | 4 +-- ext/tidy/tests/036.phpt | 36 +++++++++---------- ext/tidy/tests/bug77040.phpt | 2 +- ext/tidy/tests/gh20374.phpt | 2 +- ext/tidy/tests/gh21682.phpt | 4 +-- .../tests/open_basedir_failure_config.phpt | 4 +-- ext/tidy/tests/parsing_inexistent_file.phpt | 4 +-- ext/tidy/tests/tidy_error1.phpt | 10 +++--- ext/tidy/tests/uninitialized.phpt | 12 +++---- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/ext/tidy/tests/007.phpt b/ext/tidy/tests/007.phpt index fbb3731b1d01..09acb879dd21 100644 --- a/ext/tidy/tests/007.phpt +++ b/ext/tidy/tests/007.phpt @@ -17,13 +17,13 @@ var_dump($a->getopt("tab-size")); try { $a->getopt('bogus-opt'); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { tidy_getopt($a, 'non-ASCII string ���'); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> @@ -31,5 +31,5 @@ try { Current Value of 'tidy-mark': bool(false) Current Value of 'error-file': string(0) "" Current Value of 'tab-size': int(8) -tidy::getOpt(): Argument #1 ($option) is an invalid configuration option, "bogus-opt" given -tidy_getopt(): Argument #2 ($option) is an invalid configuration option, "non-ASCII string ���" given +ValueError: tidy::getOpt(): Argument #1 ($option) is an invalid configuration option, "bogus-opt" given +ValueError: tidy_getopt(): Argument #2 ($option) is an invalid configuration option, "non-ASCII string ���" given diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt index 9bf6cf6349a3..411719cce25e 100644 --- a/ext/tidy/tests/019.phpt +++ b/ext/tidy/tests/019.phpt @@ -15,12 +15,12 @@ tidy_repair_string($l, $l, $l); try { tidy_repair_file($s, $l, $l, $l); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { tidy_repair_file($s, $s, $s, $s); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } tidy_repair_file($l, $l, $l ,$l); // This doesn't emit any warning, TODO look into @@ -37,6 +37,6 @@ Warning: tidy_repair_string(): Could not load the Tidy configuration file "" in Warning: tidy_repair_string(): Could not load the Tidy configuration file "1" in %s on line %d Warning: tidy_repair_string(): Could not set encoding "1" in %s on line %d -Path must not be empty -Path must not be empty +ValueError: Path must not be empty +ValueError: Path must not be empty Done diff --git a/ext/tidy/tests/021.phpt b/ext/tidy/tests/021.phpt index f4c2a99017f8..22e351e4d9dc 100644 --- a/ext/tidy/tests/021.phpt +++ b/ext/tidy/tests/021.phpt @@ -10,7 +10,7 @@ tidy try { tidy_get_opt_doc(new tidy, 'some_bogus_cfg'); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $t = new tidy; @@ -18,6 +18,6 @@ var_dump($t->getOptDoc('ncr')); var_dump(strlen(tidy_get_opt_doc($t, 'wrap')) > 99); ?> --EXPECT-- -tidy_get_opt_doc(): Argument #2 ($option) is an invalid configuration option, "some_bogus_cfg" given +ValueError: tidy_get_opt_doc(): Argument #2 ($option) is an invalid configuration option, "some_bogus_cfg" given string(73) "This option specifies if Tidy should allow numeric character references. " bool(true) diff --git a/ext/tidy/tests/036.phpt b/ext/tidy/tests/036.phpt index d328c4862fe7..0de72c10c6be 100644 --- a/ext/tidy/tests/036.phpt +++ b/ext/tidy/tests/036.phpt @@ -11,65 +11,65 @@ $node = $tidy->body(); try { $node->value = ""; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->name = ""; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->type = 1; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->line = 1; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->column = 1; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->proprietary = true; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->id = null; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->attribute = []; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $node->child = []; } catch (Error $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Cannot modify readonly property tidyNode::$value -Cannot modify readonly property tidyNode::$name -Cannot modify readonly property tidyNode::$type -Cannot modify readonly property tidyNode::$line -Cannot modify readonly property tidyNode::$column -Cannot modify readonly property tidyNode::$proprietary -Cannot modify readonly property tidyNode::$id -Cannot modify readonly property tidyNode::$attribute -Cannot modify readonly property tidyNode::$child +Error: Cannot modify readonly property tidyNode::$value +Error: Cannot modify readonly property tidyNode::$name +Error: Cannot modify readonly property tidyNode::$type +Error: Cannot modify readonly property tidyNode::$line +Error: Cannot modify readonly property tidyNode::$column +Error: Cannot modify readonly property tidyNode::$proprietary +Error: Cannot modify readonly property tidyNode::$id +Error: Cannot modify readonly property tidyNode::$attribute +Error: Cannot modify readonly property tidyNode::$child diff --git a/ext/tidy/tests/bug77040.phpt b/ext/tidy/tests/bug77040.phpt index 417c5e5f8924..a4f4c1613aa9 100644 --- a/ext/tidy/tests/bug77040.phpt +++ b/ext/tidy/tests/bug77040.phpt @@ -22,4 +22,4 @@ bool(true) bool(true) bool(false) bool(true) -bool(false) \ No newline at end of file +bool(false) diff --git a/ext/tidy/tests/gh20374.phpt b/ext/tidy/tests/gh20374.phpt index 73299856b081..fb7bca73ee61 100644 --- a/ext/tidy/tests/gh20374.phpt +++ b/ext/tidy/tests/gh20374.phpt @@ -50,7 +50,7 @@ foreach ($values as $key => $value) { $tidy->parseString($str, $config, 'utf8'); echo $tidy->value, "\n"; } catch (Throwable $e) { - echo $e::class, ": ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } diff --git a/ext/tidy/tests/gh21682.phpt b/ext/tidy/tests/gh21682.phpt index 33ec0045961c..f1b7bce1ff09 100644 --- a/ext/tidy/tests/gh21682.phpt +++ b/ext/tidy/tests/gh21682.phpt @@ -9,7 +9,7 @@ try { serialize($t); echo "ERROR: should have thrown\n"; } catch (\Exception $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $t->parseString("test"); @@ -18,7 +18,7 @@ try { serialize($node); echo "ERROR: should have thrown\n"; } catch (\Exception $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- diff --git a/ext/tidy/tests/open_basedir_failure_config.phpt b/ext/tidy/tests/open_basedir_failure_config.phpt index 3b12c9e4ea8f..e7bdfd46f881 100644 --- a/ext/tidy/tests/open_basedir_failure_config.phpt +++ b/ext/tidy/tests/open_basedir_failure_config.phpt @@ -20,7 +20,7 @@ echo "=== __construct ===\n"; try { $tidy = new tidy(__DIR__.'/open_basedir/test.html', 'my_config_file.ini'); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "=== parseFile ===\n"; @@ -42,7 +42,7 @@ Warning: tidy_parse_string(): open_basedir restriction in effect. File(my_config Warning: tidy_parse_file(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir) in %s on line %d === __construct === -tidy::__construct(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir) +Exception: tidy::__construct(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir) === parseFile === Warning: tidy::parseFile(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir) in %s on line %d diff --git a/ext/tidy/tests/parsing_inexistent_file.phpt b/ext/tidy/tests/parsing_inexistent_file.phpt index e5f73c5388ce..ca9690683500 100644 --- a/ext/tidy/tests/parsing_inexistent_file.phpt +++ b/ext/tidy/tests/parsing_inexistent_file.phpt @@ -13,7 +13,7 @@ var_dump(tidy_parse_file("does_not_exist.html")); try { $tidy = new tidy("does_not_exist.html"); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- @@ -22,4 +22,4 @@ bool(false) Warning: tidy_parse_file(): Cannot load "does_not_exist.html" into memory in %s on line %d bool(false) -Cannot load "does_not_exist.html" into memory +Exception: Cannot load "does_not_exist.html" into memory diff --git a/ext/tidy/tests/tidy_error1.phpt b/ext/tidy/tests/tidy_error1.phpt index 5e7593762a93..e565db3aecea 100644 --- a/ext/tidy/tests/tidy_error1.phpt +++ b/ext/tidy/tests/tidy_error1.phpt @@ -14,14 +14,14 @@ $tidy = new tidy(); try { $tidy->parseString($buffer, $config); } catch (\ValueError $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $config = ['neither']; try { $tidy->parseString($buffer, $config); } catch (\TypeError $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $config = ['doctype-mode' => 'customtag']; @@ -29,7 +29,7 @@ $config = ['doctype-mode' => 'customtag']; try { var_dump($tidy->parseString($buffer, $config)); } catch (\ValueError $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $config = ['doctype' => 'php']; @@ -37,7 +37,7 @@ $config = ['doctype' => 'php']; try { var_dump($tidy->parseString($buffer, $config)); } catch (\TypeError $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $config = ['doctype' => 'auto', 0 => 'value2']; @@ -45,7 +45,7 @@ $config = ['doctype' => 'auto', 0 => 'value2']; try { var_dump($tidy->parseString($buffer, $config)); } catch (\TypeError $e) { - echo $e::class, ": ", $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> diff --git a/ext/tidy/tests/uninitialized.phpt b/ext/tidy/tests/uninitialized.phpt index 7793f9725b19..38dd124c9623 100644 --- a/ext/tidy/tests/uninitialized.phpt +++ b/ext/tidy/tests/uninitialized.phpt @@ -9,21 +9,21 @@ $tidy = new tidy; try { var_dump($tidy->getHtmlVer()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($tidy->isXhtml()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($tidy->isXml()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -tidy object is not initialized -tidy object is not initialized -tidy object is not initialized +Error: tidy object is not initialized +Error: tidy object is not initialized +Error: tidy object is not initialized From bbbe91c963f2da2212fe0fe1acac9f6b05abdb6c Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:48 +0000 Subject: [PATCH 21/23] ext/tokenizer: applied fixers to improve test robustness --- .../tests/PhpToken_extension_errors.phpt | 8 +++---- ext/tokenizer/tests/PhpToken_methods.phpt | 24 +++++++++---------- ext/tokenizer/tests/parse_errors.phpt | 10 ++++---- .../tests/token_get_all_TOKEN_PARSE_000.phpt | 4 ++-- .../tests/token_get_all_heredoc_nowdoc.phpt | 16 ++++++------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ext/tokenizer/tests/PhpToken_extension_errors.phpt b/ext/tokenizer/tests/PhpToken_extension_errors.phpt index c0676c6b7952..241bdae61572 100644 --- a/ext/tokenizer/tests/PhpToken_extension_errors.phpt +++ b/ext/tokenizer/tests/PhpToken_extension_errors.phpt @@ -12,7 +12,7 @@ class MyPhpToken1 extends PhpToken { try { var_dump(MyPhpToken1::tokenize("getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } abstract class MyPhpToken2 extends PhpToken { @@ -21,10 +21,10 @@ abstract class MyPhpToken2 extends PhpToken { try { var_dump(MyPhpToken2::tokenize("getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Undefined constant "UNKNOWN" -Cannot instantiate abstract class MyPhpToken2 +Error: Undefined constant "UNKNOWN" +Error: Cannot instantiate abstract class MyPhpToken2 diff --git a/ext/tokenizer/tests/PhpToken_methods.phpt b/ext/tokenizer/tests/PhpToken_methods.phpt index 13aee9856931..80d149f6ddf0 100644 --- a/ext/tokenizer/tests/PhpToken_methods.phpt +++ b/ext/tokenizer/tests/PhpToken_methods.phpt @@ -40,12 +40,12 @@ echo "\nError:\n"; try { $token->is(3.141); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $token->is([3.141]); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } unset($token->id); @@ -53,22 +53,22 @@ unset($token->text); try { $token->is(T_FUNCTION); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $token->is('function'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $token->is([T_FUNCTION]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $token->is(['function']); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "\nName of unknown token:\n"; @@ -110,12 +110,12 @@ bool(false) bool(false) Error: -PhpToken::is(): Argument #1 ($kind) must be of type string|int|array, float given -PhpToken::is(): Argument #1 ($kind) must only have elements of type string|int, float given -Typed property PhpToken::$id must not be accessed before initialization -Typed property PhpToken::$text must not be accessed before initialization -Typed property PhpToken::$id must not be accessed before initialization -Typed property PhpToken::$text must not be accessed before initialization +TypeError: PhpToken::is(): Argument #1 ($kind) must be of type string|int|array, float given +TypeError: PhpToken::is(): Argument #1 ($kind) must only have elements of type string|int, float given +Error: Typed property PhpToken::$id must not be accessed before initialization +Error: Typed property PhpToken::$text must not be accessed before initialization +Error: Typed property PhpToken::$id must not be accessed before initialization +Error: Typed property PhpToken::$text must not be accessed before initialization Name of unknown token: NULL diff --git a/ext/tokenizer/tests/parse_errors.phpt b/ext/tokenizer/tests/parse_errors.phpt index 2985272b3749..9e44105e9249 100644 --- a/ext/tokenizer/tests/parse_errors.phpt +++ b/ext/tokenizer/tests/parse_errors.phpt @@ -9,7 +9,7 @@ function test_parse_error($code) { try { var_dump(token_get_all($code, TOKEN_PARSE)); } catch (ParseError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } foreach (token_get_all($code) as $token) { @@ -29,7 +29,7 @@ test_parse_error(' --EXPECT-- -Invalid numeric literal +ParseError: Invalid numeric literal T_OPEN_TAG (getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } echo "Done"; ?> --EXPECT-- -syntax error, unexpected identifier "code" +ParseError: syntax error, unexpected identifier "code" Done diff --git a/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt b/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt index 6b3010d7cf41..62fc1a9c74bb 100644 --- a/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt +++ b/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt @@ -15,7 +15,7 @@ function test(string $code, int $flags) } } } catch (ParseError $e) { - echo "Parse error: {$e->getMessage()} on line {$e->getLine()}\n"; + echo $e::class, ': ', $e->getMessage(), ' on line ', $e->getLine(), "\n"; } } @@ -326,11 +326,11 @@ Line 2: T_END_HEREDOC (' INNER_END') Test case 5 -Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2 +ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2 Test case 6 -Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2 +ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2 Test case 7 @@ -343,7 +343,7 @@ Line 3: T_END_HEREDOC ('INNER_END') Test case 8 -Parse error: Invalid indentation - tabs and spaces cannot be mixed on line 3 +ParseError: Invalid indentation - tabs and spaces cannot be mixed on line 3 Test case 9 @@ -365,7 +365,7 @@ Line 3: T_END_HEREDOC (' INNER_END') Test case 11 -Parse error: Invalid body indentation level (expecting an indentation level of at least 3) on line 2 +ParseError: Invalid body indentation level (expecting an indentation level of at least 3) on line 2 Test case 12 @@ -396,7 +396,7 @@ Line 3: T_END_HEREDOC (' INNER_END') Test case 15 -Parse error: Invalid body indentation level (expecting an indentation level of at least 3) on line 2 +ParseError: Invalid body indentation level (expecting an indentation level of at least 3) on line 2 Test case 16 @@ -409,8 +409,8 @@ Line 3: T_END_HEREDOC (' INNER_END') Test case 17 -Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4 +ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4 Test case 18 -Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4 +ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4 From 9ad133c629b98444e6549742310c16b92aed971d Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:49 +0000 Subject: [PATCH 22/23] ext/zend_test: applied fixers to improve test robustness --- ext/zend_test/tests/gh13970.phpt | 4 ++-- ext/zend_test/tests/gh14741.phpt | 4 ++-- ext/zend_test/tests/gh16266.phpt | 8 ++++---- ext/zend_test/tests/gh17899.phpt | 1 - ext/zend_test/tests/gh19720.phpt | 4 ++-- ext/zend_test/tests/gh22169.phpt | 1 - ext/zend_test/tests/internal_dnf_arguments.phpt | 4 ++-- ext/zend_test/tests/observer_bug81430_1.phpt | 2 +- ext/zend_test/tests/observer_error_04.phpt | 4 ++-- ext/zend_test/tests/observer_preload.phpt | 2 +- ext/zend_test/tests/zend_forbid_dynamic_call.phpt | 8 ++++---- .../tests/zend_internal_class_prop_intersection.phpt | 8 ++++---- ext/zend_test/tests/zend_test_compile_string.phpt | 4 ++-- 13 files changed, 26 insertions(+), 28 deletions(-) diff --git a/ext/zend_test/tests/gh13970.phpt b/ext/zend_test/tests/gh13970.phpt index f6b68f897023..bdf6d0891fc7 100644 --- a/ext/zend_test/tests/gh13970.phpt +++ b/ext/zend_test/tests/gh13970.phpt @@ -15,8 +15,8 @@ $reflection = new ReflectionFunction('test'); try { var_dump($reflection->getAttributes()[0]->newInstance()); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Attribute::__construct(): Argument #1 ($flags) must be of type int, ZendTestUnitEnum given +Error: Attribute::__construct(): Argument #1 ($flags) must be of type int, ZendTestUnitEnum given diff --git a/ext/zend_test/tests/gh14741.phpt b/ext/zend_test/tests/gh14741.phpt index 389692f3de2b..c9b064d3207c 100644 --- a/ext/zend_test/tests/gh14741.phpt +++ b/ext/zend_test/tests/gh14741.phpt @@ -9,9 +9,9 @@ $it = $subject->getIterator(); try { clone $it; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Trying to clone an uncloneable object of class InternalIterator +Error: Trying to clone an uncloneable object of class InternalIterator TraversableTest::drop diff --git a/ext/zend_test/tests/gh16266.phpt b/ext/zend_test/tests/gh16266.phpt index 44cb7ef807c1..ed755515d7f0 100644 --- a/ext/zend_test/tests/gh16266.phpt +++ b/ext/zend_test/tests/gh16266.phpt @@ -8,14 +8,14 @@ try { $o = new _ZendTestClass(); $o->test('a', 'b', c: 'c'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { _ZendTestClass::test('a', 'b', c: 'c'); } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Unknown named parameter $c -Unknown named parameter $c +Error: Unknown named parameter $c +Error: Unknown named parameter $c diff --git a/ext/zend_test/tests/gh17899.phpt b/ext/zend_test/tests/gh17899.phpt index 58f445a3b7bf..8d8ac963227c 100644 --- a/ext/zend_test/tests/gh17899.phpt +++ b/ext/zend_test/tests/gh17899.phpt @@ -32,4 +32,3 @@ Stack trace: thrown in on line %d - diff --git a/ext/zend_test/tests/gh19720.phpt b/ext/zend_test/tests/gh19720.phpt index 627444c4793a..fabdcaf70512 100644 --- a/ext/zend_test/tests/gh19720.phpt +++ b/ext/zend_test/tests/gh19720.phpt @@ -15,8 +15,8 @@ set_error_handler(function ($_, $errstr) { try { var_dump(Test::MyConst); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Constant ZEND_TEST_DEPRECATED is deprecated +Exception: Constant ZEND_TEST_DEPRECATED is deprecated diff --git a/ext/zend_test/tests/gh22169.phpt b/ext/zend_test/tests/gh22169.phpt index 5ed2ab22fa21..2511a36f0456 100644 --- a/ext/zend_test/tests/gh22169.phpt +++ b/ext/zend_test/tests/gh22169.phpt @@ -19,4 +19,3 @@ var_dump(_ZendTestClass::$escapeInterpolated); string(44) "424547494e200a0d090b1b0c5c242241414120454e44" string(43) "BEGIN \n\r\t\v\e\f\\\\$\"\101\x41\u{41} END" string(14) "begin $ \$ end" - diff --git a/ext/zend_test/tests/internal_dnf_arguments.phpt b/ext/zend_test/tests/internal_dnf_arguments.phpt index eb6f5fb514f0..47f0aba19d1d 100644 --- a/ext/zend_test/tests/internal_dnf_arguments.phpt +++ b/ext/zend_test/tests/internal_dnf_arguments.phpt @@ -15,7 +15,7 @@ var_dump((string)$paramType); try { zend_test_internal_dnf_arguments(new stdClass); } catch (\Throwable $err) { - echo $err->getMessage(), "\n"; + echo $err::class, ': ', $err->getMessage(), "\n"; } $obj = new \ArrayIterator([]); @@ -26,7 +26,7 @@ var_dump($result); --EXPECT-- string(32) "Iterator|(Traversable&Countable)" string(32) "Iterator|(Traversable&Countable)" -zend_test_internal_dnf_arguments(): Argument #1 ($arg) must be of type Iterator|(Traversable&Countable), stdClass given +TypeError: zend_test_internal_dnf_arguments(): Argument #1 ($arg) must be of type Iterator|(Traversable&Countable), stdClass given object(ArrayIterator)#5 (1) { ["storage":"ArrayIterator":private]=> array(0) { diff --git a/ext/zend_test/tests/observer_bug81430_1.phpt b/ext/zend_test/tests/observer_bug81430_1.phpt index aedfc09ed249..5754fa00f51a 100644 --- a/ext/zend_test/tests/observer_bug81430_1.phpt +++ b/ext/zend_test/tests/observer_bug81430_1.phpt @@ -38,4 +38,4 @@ call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); - \ No newline at end of file + diff --git a/ext/zend_test/tests/observer_error_04.phpt b/ext/zend_test/tests/observer_error_04.phpt index 2a45bfe78c48..dc1955606575 100644 --- a/ext/zend_test/tests/observer_error_04.phpt +++ b/ext/zend_test/tests/observer_error_04.phpt @@ -25,7 +25,7 @@ function main() try { main(); } catch (SoapFault $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } echo 'Done.' . PHP_EOL; @@ -45,7 +45,7 @@ echo 'Done.' . PHP_EOL; - +SoapFault: diff --git a/ext/zend_test/tests/observer_preload.phpt b/ext/zend_test/tests/observer_preload.phpt index 042c9e088e53..731cc2efa798 100644 --- a/ext/zend_test/tests/observer_preload.phpt +++ b/ext/zend_test/tests/observer_preload.phpt @@ -43,4 +43,4 @@ echo 'Done' . PHP_EOL; Done - \ No newline at end of file + diff --git a/ext/zend_test/tests/zend_forbid_dynamic_call.phpt b/ext/zend_test/tests/zend_forbid_dynamic_call.phpt index 77d8649f5322..0e8a8d170092 100644 --- a/ext/zend_test/tests/zend_forbid_dynamic_call.phpt +++ b/ext/zend_test/tests/zend_forbid_dynamic_call.phpt @@ -13,17 +13,17 @@ try { $call = [$object, 'call']; $call(); } catch (Error $error) { - echo $error->getMessage(), "\n"; + echo $error::class, ': ', $error->getMessage(), "\n"; } try { $callStatic = [ZendTestForbidDynamicCall::class, 'callStatic']; $callStatic(); } catch (Error $error) { - echo $error->getMessage(), "\n"; + echo $error::class, ': ', $error->getMessage(), "\n"; } ?> --EXPECT-- -Cannot call ZendTestForbidDynamicCall::call() dynamically -Cannot call ZendTestForbidDynamicCall::callStatic() dynamically +Error: Cannot call ZendTestForbidDynamicCall::call() dynamically +Error: Cannot call ZendTestForbidDynamicCall::callStatic() dynamically diff --git a/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt b/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt index dd9fe93a130e..f7f421f27d87 100644 --- a/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt +++ b/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt @@ -28,12 +28,12 @@ try { try { $o->classIntersectionProp = new EmptyIterator(); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { $o->classIntersectionProp = new C(); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $o->classIntersectionProp = new I(); @@ -41,6 +41,6 @@ $o->classIntersectionProp = new I(); ==DONE== --EXPECT-- Error: Typed property _ZendTestClass::$classIntersectionProp must not be accessed before initialization -Cannot assign EmptyIterator to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable -Cannot assign C to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable +TypeError: Cannot assign EmptyIterator to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable +TypeError: Cannot assign C to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable ==DONE== diff --git a/ext/zend_test/tests/zend_test_compile_string.phpt b/ext/zend_test/tests/zend_test_compile_string.phpt index fb47f748f87a..543c086bdb7a 100644 --- a/ext/zend_test/tests/zend_test_compile_string.phpt +++ b/ext/zend_test/tests/zend_test_compile_string.phpt @@ -46,7 +46,7 @@ EOF; try { zend_test_compile_string($source_string, "Sources\0string", ZEND_COMPILE_POSITION_AT_OPEN_TAG); } catch (\ValueError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } zend_test_compile_string(null, null, null); @@ -65,7 +65,7 @@ string(3) "php" string(3) "php" string(3) "php" string(3) "php" -zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes +ValueError: zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes Deprecated: zend_test_compile_string(): Passing null to parameter #1 ($source_string) of type string is deprecated in %s on line %d From b3ffaeb2c8239b32a0043eadb5e4f672885d37c3 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Sat, 1 Aug 2026 15:50:49 +0000 Subject: [PATCH 23/23] ext/zlib: applied fixers to improve test robustness --- ext/zlib/tests/deflate_add_error.phpt | 8 ++++---- ext/zlib/tests/deflate_init_error.phpt | 20 +++++++++---------- .../deflate_init_strategy_type_error.phpt | 16 +++++++-------- ext/zlib/tests/gh16326.phpt | 12 +++++------ ext/zlib/tests/gh22142.phpt | 4 ++-- ext/zlib/tests/gzclose_basic.phpt | 8 ++++---- ext/zlib/tests/gzcompress_error1.phpt | 8 ++++---- ext/zlib/tests/gzdeflate_error1.phpt | 8 ++++---- ext/zlib/tests/gzencode_error1.phpt | 8 ++++---- ext/zlib/tests/gzencode_invalid.phpt | 16 +++++++-------- ext/zlib/tests/gzeof_variation1.phpt | 4 ++-- ext/zlib/tests/gzfile_variation15.phpt | 1 - ext/zlib/tests/gzopen_variation9.phpt | 1 - ext/zlib/tests/gzread_error2.phpt | 8 ++++---- ext/zlib/tests/gzwrite_error2.phpt | 1 - ext/zlib/tests/inflate_add_error.phpt | 8 ++++---- ext/zlib/tests/inflate_init_error.phpt | 4 ++-- .../tests/inflate_init_window_type_error.phpt | 4 ++-- .../leak_invalid_encoding_with_dict.phpt | 8 ++++---- 19 files changed, 72 insertions(+), 75 deletions(-) diff --git a/ext/zlib/tests/deflate_add_error.phpt b/ext/zlib/tests/deflate_add_error.phpt index af7b95b79011..b4fc42aaf31f 100644 --- a/ext/zlib/tests/deflate_add_error.phpt +++ b/ext/zlib/tests/deflate_add_error.phpt @@ -9,7 +9,7 @@ $badResource = fopen("php://memory", "r+"); try { var_dump(deflate_add($badResource, "test")); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $resource = deflate_init(ZLIB_ENCODING_DEFLATE); @@ -18,10 +18,10 @@ $badFlushType = 6789; try { var_dump(deflate_add($resource, "test", $badFlushType)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given -deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH +TypeError: deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given +ValueError: deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH diff --git a/ext/zlib/tests/deflate_init_error.phpt b/ext/zlib/tests/deflate_init_error.phpt index 6752b650e248..9fe0323a7d22 100644 --- a/ext/zlib/tests/deflate_init_error.phpt +++ b/ext/zlib/tests/deflate_init_error.phpt @@ -8,37 +8,37 @@ zlib try { var_dump(deflate_init(42)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 42])); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => -2])); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 0])); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 10])); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE -deflate_init(): "level" option must be between -1 and 9 -deflate_init(): "level" option must be between -1 and 9 -deflate_init(): "memory" option must be between 1 and 9 -deflate_init(): "memory" option must be between 1 and 9 +ValueError: deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: deflate_init(): "level" option must be between -1 and 9 +ValueError: deflate_init(): "level" option must be between -1 and 9 +ValueError: deflate_init(): "memory" option must be between 1 and 9 +ValueError: deflate_init(): "memory" option must be between 1 and 9 diff --git a/ext/zlib/tests/deflate_init_strategy_type_error.phpt b/ext/zlib/tests/deflate_init_strategy_type_error.phpt index 2a59082bc320..7b2e9184529a 100644 --- a/ext/zlib/tests/deflate_init_strategy_type_error.phpt +++ b/ext/zlib/tests/deflate_init_strategy_type_error.phpt @@ -11,32 +11,32 @@ $fp = fopen('php://memory', 'r'); try { deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 'foo']); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => []]); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { deflate_init(ZLIB_ENCODING_DEFLATE, ['window' => new A()]); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { deflate_init(ZLIB_ENCODING_DEFLATE, ['strategy' => $fp]); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } fclose($fp); ?> --EXPECT-- -deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, string given -deflate_init(): Argument #2 ($options) the value for option "memory" must be of type int, array given -deflate_init(): Argument #2 ($options) the value for option "window" must be of type int, A given -deflate_init(): Argument #2 ($options) the value for option "strategy" must be of type int, resource given +TypeError: deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, string given +TypeError: deflate_init(): Argument #2 ($options) the value for option "memory" must be of type int, array given +TypeError: deflate_init(): Argument #2 ($options) the value for option "window" must be of type int, A given +TypeError: deflate_init(): Argument #2 ($options) the value for option "strategy" must be of type int, resource given diff --git a/ext/zlib/tests/gh16326.phpt b/ext/zlib/tests/gh16326.phpt index b4997368549f..fe7eb1370957 100644 --- a/ext/zlib/tests/gh16326.phpt +++ b/ext/zlib/tests/gh16326.phpt @@ -7,20 +7,20 @@ zlib try { deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => [" ", ""]]); } catch (ValueError $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => ["hello", "wor\0ld"]]); } catch (ValueError $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } try { deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => [" ", new stdClass]]); } catch (Error $ex) { - echo $ex->getMessage(), "\n"; + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -deflate_init(): Argument #2 ($options) must not contain empty strings -deflate_init(): Argument #2 ($options) must not contain strings with null bytes -Object of class stdClass could not be converted to string +ValueError: deflate_init(): Argument #2 ($options) must not contain empty strings +ValueError: deflate_init(): Argument #2 ($options) must not contain strings with null bytes +Error: Object of class stdClass could not be converted to string diff --git a/ext/zlib/tests/gh22142.phpt b/ext/zlib/tests/gh22142.phpt index 84397a4e85a9..9bbb9332df30 100644 --- a/ext/zlib/tests/gh22142.phpt +++ b/ext/zlib/tests/gh22142.phpt @@ -12,9 +12,9 @@ class Options { try { deflate_init(ZLIB_ENCODING_DEFLATE, new Options()); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given +TypeError: deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt index f2e03a579de5..28a215681c0c 100644 --- a/ext/zlib/tests/gzclose_basic.phpt +++ b/ext/zlib/tests/gzclose_basic.phpt @@ -16,7 +16,7 @@ var_dump(gzclose($h)); try { gzread($h, 20); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $h = gzopen($f, 'r'); @@ -27,13 +27,13 @@ var_dump(fclose($h)); try { gzread($h, 20); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- bool(true) -gzread(): Argument #1 ($stream) must be an open stream resource +TypeError: gzread(): Argument #1 ($stream) must be an open stream resource bool(true) -gzread(): Argument #1 ($stream) must be an open stream resource +TypeError: gzread(): Argument #1 ($stream) must be an open stream resource diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt index b21743755417..f21daedd537e 100644 --- a/ext/zlib/tests/gzcompress_error1.phpt +++ b/ext/zlib/tests/gzcompress_error1.phpt @@ -16,7 +16,7 @@ $bad_level = 99; try { var_dump(gzcompress($data, $bad_level)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } echo "\n-- Testing with invalid encoding --\n"; @@ -25,7 +25,7 @@ $encoding = 99; try { var_dump(gzcompress($data, $level, $encoding)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> @@ -33,7 +33,7 @@ try { *** Testing gzcompress() : error conditions *** -- Testing with incorrect compression level -- -gzcompress(): Argument #2 ($level) must be between -1 and 9 +ValueError: gzcompress(): Argument #2 ($level) must be between -1 and 9 -- Testing with invalid encoding -- -gzcompress(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: gzcompress(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt index 9b065edfc24e..75959f85cb09 100644 --- a/ext/zlib/tests/gzdeflate_error1.phpt +++ b/ext/zlib/tests/gzdeflate_error1.phpt @@ -17,7 +17,7 @@ $bad_level = 99; try { var_dump(gzdeflate($data, $bad_level)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } echo "\n-- Testing with incorrect encoding --\n"; @@ -26,7 +26,7 @@ $bad_encoding = 99; try { var_dump(gzdeflate($data, $level, $bad_encoding)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> @@ -34,7 +34,7 @@ try { *** Testing gzdeflate() : error conditions *** -- Testing with incorrect compression level -- -gzdeflate(): Argument #2 ($level) must be between -1 and 9 +ValueError: gzdeflate(): Argument #2 ($level) must be between -1 and 9 -- Testing with incorrect encoding -- -gzdeflate(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: gzdeflate(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE diff --git a/ext/zlib/tests/gzencode_error1.phpt b/ext/zlib/tests/gzencode_error1.phpt index 8428d3b950dc..c15d47f5b1f5 100644 --- a/ext/zlib/tests/gzencode_error1.phpt +++ b/ext/zlib/tests/gzencode_error1.phpt @@ -19,7 +19,7 @@ $bad_level = 99; try { var_dump(gzencode($data, $bad_level)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } echo "\n-- Testing with incorrect encoding_mode --\n"; @@ -27,7 +27,7 @@ $bad_mode = 99; try { var_dump(gzencode($data, $level, $bad_mode)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> @@ -35,7 +35,7 @@ try { *** Testing gzencode() : error conditions *** -- Testing with incorrect compression level -- -gzencode(): Argument #2 ($level) must be between -1 and 9 +ValueError: gzencode(): Argument #2 ($level) must be between -1 and 9 -- Testing with incorrect encoding_mode -- -gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE diff --git a/ext/zlib/tests/gzencode_invalid.phpt b/ext/zlib/tests/gzencode_invalid.phpt index e64bb294b3e8..98df53825feb 100644 --- a/ext/zlib/tests/gzencode_invalid.phpt +++ b/ext/zlib/tests/gzencode_invalid.phpt @@ -8,17 +8,17 @@ zlib try { var_dump(gzencode("", -10)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(gzencode("", 100)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(gzencode("", 1, 100)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP)); @@ -32,7 +32,7 @@ Lies in the darkness"; try { var_dump(gzencode($string, 9, 3)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP)); @@ -40,11 +40,11 @@ var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE)); ?> --EXPECTF-- -gzencode(): Argument #2 ($level) must be between -1 and 9 -gzencode(): Argument #2 ($level) must be between -1 and 9 -gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: gzencode(): Argument #2 ($level) must be between -1 and 9 +ValueError: gzencode(): Argument #2 ($level) must be between -1 and 9 +ValueError: gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE string(%d) "%a" string(%d) "%a" -gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE string(%d) "%a" string(%d) "%a" diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt index fb4191fa7940..55bfc55cab40 100644 --- a/ext/zlib/tests/gzeof_variation1.phpt +++ b/ext/zlib/tests/gzeof_variation1.phpt @@ -17,11 +17,11 @@ gzclose($h); try { var_dump(gzeof($h)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } unlink($filename); ?> --EXPECT-- bool(false) bool(false) -gzeof(): Argument #1 ($stream) must be an open stream resource +TypeError: gzeof(): Argument #1 ($stream) must be an open stream resource diff --git a/ext/zlib/tests/gzfile_variation15.phpt b/ext/zlib/tests/gzfile_variation15.phpt index f33abba0284b..922718ce0181 100644 --- a/ext/zlib/tests/gzfile_variation15.phpt +++ b/ext/zlib/tests/gzfile_variation15.phpt @@ -99,4 +99,3 @@ array(1) { [0]=> string(28) "This is a file in script dir" } - diff --git a/ext/zlib/tests/gzopen_variation9.phpt b/ext/zlib/tests/gzopen_variation9.phpt index 0118dd3ea130..78f512f9d923 100644 --- a/ext/zlib/tests/gzopen_variation9.phpt +++ b/ext/zlib/tests/gzopen_variation9.phpt @@ -40,4 +40,3 @@ mode=e Warning: gzopen(): Failed to open stream: %s in %s on line %d gzopen=bool(false) - diff --git a/ext/zlib/tests/gzread_error2.phpt b/ext/zlib/tests/gzread_error2.phpt index 0a3d08efd09a..ab7231f64c93 100644 --- a/ext/zlib/tests/gzread_error2.phpt +++ b/ext/zlib/tests/gzread_error2.phpt @@ -10,13 +10,13 @@ var_dump(gzread($h, 10)); try { var_dump(gzread($h, 0)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(gzread($h, 5)); try { var_dump(gzread($h, -1)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } var_dump(gzread($h, 8)); gzclose($h); @@ -24,7 +24,7 @@ gzclose($h); ?> --EXPECT-- string(10) "When you'r" -gzread(): Argument #2 ($length) must be greater than 0 +ValueError: gzread(): Argument #2 ($length) must be greater than 0 string(5) "e tau" -gzread(): Argument #2 ($length) must be greater than 0 +ValueError: gzread(): Argument #2 ($length) must be greater than 0 string(8) "ght thro" diff --git a/ext/zlib/tests/gzwrite_error2.phpt b/ext/zlib/tests/gzwrite_error2.phpt index 5201f8064ae1..1e71e4b55485 100644 --- a/ext/zlib/tests/gzwrite_error2.phpt +++ b/ext/zlib/tests/gzwrite_error2.phpt @@ -21,4 +21,3 @@ unlink($filename); --EXPECT-- int(0) int(0) - diff --git a/ext/zlib/tests/inflate_add_error.phpt b/ext/zlib/tests/inflate_add_error.phpt index 129fd5b794f7..1d805ba5f9d2 100644 --- a/ext/zlib/tests/inflate_add_error.phpt +++ b/ext/zlib/tests/inflate_add_error.phpt @@ -9,7 +9,7 @@ $badResource = fopen("php://memory", "r+"); try { var_dump(inflate_add($badResource, "test")); } catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $resource = inflate_init(ZLIB_ENCODING_DEFLATE); @@ -17,10 +17,10 @@ $badFlushType = 6789; try { var_dump(inflate_add($resource, "test", $badFlushType)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -inflate_add(): Argument #1 ($context) must be of type InflateContext, resource given -inflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH +TypeError: inflate_add(): Argument #1 ($context) must be of type InflateContext, resource given +ValueError: inflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH diff --git a/ext/zlib/tests/inflate_init_error.phpt b/ext/zlib/tests/inflate_init_error.phpt index 9854f7453909..a5b6f6ca9897 100644 --- a/ext/zlib/tests/inflate_init_error.phpt +++ b/ext/zlib/tests/inflate_init_error.phpt @@ -8,9 +8,9 @@ zlib try { var_dump(inflate_init(42)); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE diff --git a/ext/zlib/tests/inflate_init_window_type_error.phpt b/ext/zlib/tests/inflate_init_window_type_error.phpt index fbca3129681e..cd4c178f2a2c 100644 --- a/ext/zlib/tests/inflate_init_window_type_error.phpt +++ b/ext/zlib/tests/inflate_init_window_type_error.phpt @@ -8,9 +8,9 @@ zlib try { inflate_init(ZLIB_ENCODING_DEFLATE, ['window' => []]); } catch (TypeError $e) { - echo $e->getMessage(), PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -inflate_init(): Argument #2 ($options) the value for option "window" must be of type int, array given +TypeError: inflate_init(): Argument #2 ($options) the value for option "window" must be of type int, array given diff --git a/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt b/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt index 507e6842cb58..a33aa058faab 100644 --- a/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt +++ b/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt @@ -7,14 +7,14 @@ zlib try { inflate_init(123456, ["dictionary" => "dict"]); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { deflate_init(123456, ["dictionary" => "dict"]); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE -deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE +ValueError: deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE