From 68a0efedebd8ffb228ca0209035d8af696bda13c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Jul 2024 19:42:17 -0400 Subject: [PATCH 1/3] 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 21340153fae..e64aef96c9a 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 e0e76b5800c..72f449d8e06 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 27dd393be9036a9cbdb8529b1ca3a4552810b0e7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Jul 2024 07:49:01 -0400 Subject: [PATCH 2/3] 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 72f449d8e06..36d22cc859b 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 From 1006e1021e959444dcde1ca1eae773863bfc200a Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:56:04 +0200 Subject: [PATCH 3/3] NEWS for GH-14814 Closes GH-14814. --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index a4940d17434..5e468d881bf 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,9 @@ PHP NEWS . Fixed bug GH-14638 (null dereference after XML parsing failure). (David Carlier) +- Standard: + . Fix 32-bit wordwrap test failures. (orlitzky) + - Treewide: . Fix compatibility with libxml2 2.13.2. (nielsdos)