From 468c39df114a7d41b796d16df7204d70f602803d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Jul 2024 19:42:17 -0400 Subject: [PATCH 1/2] ext/standard/tests: 32bit wordwrap tests aren't just for Windows The test in strings/wordwrap_memory_limit.phpt has a counterpart in strings/wordwrap_memory_limit_win32.phpt. The two are conditional on both the OS name and the size of an int (32- versus 64-bits). A Gentoo Linux user has however reported that the 64-bit test fails on a 32-bit system, with precisely the error message that the "win32" test is expecting. I don't have any 32-bit hardware to test myself, but I think it's reasonable to conclude that the OS name is not an essential part of the test: it's simply 32- versus 64-bit. This commit drops the conditionals for the OS name. Now one test will be run on 32-bit systems, and the other on 64-bit systems, regardless of the OS name. Bug: https://bugs.gentoo.org/935382 --- ext/standard/tests/strings/wordwrap_memory_limit.phpt | 2 +- ...memory_limit_win32.phpt => wordwrap_memory_limit_32bit.phpt} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename ext/standard/tests/strings/{wordwrap_memory_limit_win32.phpt => wordwrap_memory_limit_32bit.phpt} (78%) diff --git a/ext/standard/tests/strings/wordwrap_memory_limit.phpt b/ext/standard/tests/strings/wordwrap_memory_limit.phpt index 21340153faea1..e64aef96c9a14 100644 --- a/ext/standard/tests/strings/wordwrap_memory_limit.phpt +++ b/ext/standard/tests/strings/wordwrap_memory_limit.phpt @@ -2,7 +2,7 @@ No overflow should occur during the memory_limit check for wordwrap() --SKIPIF-- --INI-- diff --git a/ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt b/ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt similarity index 78% rename from ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt rename to ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt index e0e76b5800ce2..72f449d8e0679 100644 --- a/ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt +++ b/ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt @@ -2,7 +2,7 @@ No overflow should occur during the memory_limit check for wordwrap() --SKIPIF-- --INI-- From 424e7cbb458c7fffb5b4a571142b42fb8c6e5c05 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Jul 2024 07:49:01 -0400 Subject: [PATCH 2/2] ext/standard/tests: strings/wordwrap_memory_limit_32bit.phpt has two outputs It turns out that on a 32-bit system, this test can produce either the "usual" expected output from the 64-bit test, OR the 32-bit-only integer overflow message. We copy the dual expected outputs from chunk_split_variation1_32bit.phpt to handle both cases. This fixes an earlier commit that split the two tests based only on the size of an int (32-bit versus 64-bit). The CI reveals that, at least on a debug/zts build, the "64-bit" memory limit error (and not the integer overflow error) is still produced. --- ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt b/ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt index 72f449d8e0679..36d22cc859b5b 100644 --- a/ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt +++ b/ext/standard/tests/strings/wordwrap_memory_limit_32bit.phpt @@ -16,4 +16,4 @@ wordwrap($str, 1, $str2); ?> --EXPECTF-- -Fatal error: Possible integer overflow in memory allocation (4294901777 + %d) in %s on line %d +Fatal error: %rAllowed memory size of %d bytes exhausted%s\(tried to allocate %d bytes\)|Possible integer overflow in memory allocation \(4294901777 \+ %d\)%r in %s on line %d