From 7973f99f475a48a5a39f584a4e16bc56bd7423eb Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Wed, 26 Aug 2026 10:14:06 +0800 Subject: [PATCH] test: split PHP 8.5 numeric warnings --- .../basic/pow-int-overflow-native-type.phpt | 6 +++++- .../basic/pow-int-overflow-warning-php85.phpt | 20 +++++++++++++++++++ tests/compiler/float_edge/edge-cases.phpt | 6 +++++- .../float_edge/nan-string-warning-php85.phpt | 18 +++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tests/compiler/basic/pow-int-overflow-warning-php85.phpt create mode 100644 tests/compiler/float_edge/nan-string-warning-php85.phpt diff --git a/tests/compiler/basic/pow-int-overflow-native-type.phpt b/tests/compiler/basic/pow-int-overflow-native-type.phpt index 45b7083d..bccfa002 100644 --- a/tests/compiler/basic/pow-int-overflow-native-type.phpt +++ b/tests/compiler/basic/pow-int-overflow-native-type.phpt @@ -5,9 +5,13 @@ pow int overflow use native_types; function main() { + // PHP 8.5 warns when the overflowing float is narrowed to a native int. + // This test covers the resulting value; a version-specific companion test + // covers the warning so this expectation remains stable on PHP 8.4/8.5. + error_reporting(E_ERROR); $a = 2 ** 80; echo $a, PHP_EOL; } ?> --EXPECT-- -0 \ No newline at end of file +0 diff --git a/tests/compiler/basic/pow-int-overflow-warning-php85.phpt b/tests/compiler/basic/pow-int-overflow-warning-php85.phpt new file mode 100644 index 00000000..46bb8262 --- /dev/null +++ b/tests/compiler/basic/pow-int-overflow-warning-php85.phpt @@ -0,0 +1,20 @@ +--TEST-- +PHP 8.5 warns when pow overflow is narrowed to a native int +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: The float %s is not representable as an int, cast occurred in %s on line %d +0 diff --git a/tests/compiler/float_edge/edge-cases.phpt b/tests/compiler/float_edge/edge-cases.phpt index e14b1c1e..40905e38 100644 --- a/tests/compiler/float_edge/edge-cases.phpt +++ b/tests/compiler/float_edge/edge-cases.phpt @@ -3,6 +3,7 @@ Float edge cases: NAN, INF, -INF --FILE-- +--FILE-- + +--EXPECTF-- +Warning: unexpected NAN value was coerced to string in %s on line %d +NAN