From 5ec685714b5a5ca5d5262dd105f64e90274155ed Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 17 May 2023 18:05:41 -0400 Subject: [PATCH 1/4] ext/gd/tests/bug73159.phpt: skip with external gd >= 2.3.3 This test uses the imagegd2() function to check that https://github.com/libgd/libgd/issues/289 is fixed. When an external gd without support for the "gd" format is used, no error is thrown, but a nonsense result is printed: this is normal. The corresponding upstream test is disabled in that situation; it's not expected to work. This commit skips the corresponding PHP test under the same circumstances to fix a test failure with external gd >= 2.3.3. --- ext/gd/tests/bug73159.phpt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/gd/tests/bug73159.phpt b/ext/gd/tests/bug73159.phpt index e430c827bf680..e024a70a6f741 100644 --- a/ext/gd/tests/bug73159.phpt +++ b/ext/gd/tests/bug73159.phpt @@ -2,6 +2,12 @@ Bug #73159 (imagegd2(): unrecognized formats may result in corrupted files) --EXTENSIONS-- gd +--SKIPIF-- +=')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- Date: Wed, 17 May 2023 18:14:54 -0400 Subject: [PATCH 2/4] ext/gd/tests/bug73155.phpt: skip with external gd >= 2.3.3 This test uses the imagegd2() function to check that https://github.com/libgd/libgd/issues/309 is fixed. When an external gd without support for the "gd" format is used, no error is thrown, but a nonsense result is printed: this is normal. The corresponding upstream test is disabled in that situation; it's not expected to work. This commit skips the corresponding PHP test under the same circumstances to fix a test failure with external gd >= 2.3.3. --- ext/gd/tests/bug73155.phpt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/gd/tests/bug73155.phpt b/ext/gd/tests/bug73155.phpt index 0c77585aa5527..a3746484da81a 100644 --- a/ext/gd/tests/bug73155.phpt +++ b/ext/gd/tests/bug73155.phpt @@ -2,6 +2,12 @@ Bug #73155 (imagegd2() writes wrong chunk sizes on boundaries) --EXTENSIONS-- gd +--SKIPIF-- +=')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- Date: Wed, 17 May 2023 18:19:59 -0400 Subject: [PATCH 3/4] ext/gd/tests/bug73157.phpt: skip with external gd >= 2.3.3 This test ensures that the third (chunk_size) parameter to imagegd2() is respected when a fourth parameter is also given. However, when an external gd without support for the "gd" format is used, the call to imagegd2() does not really work at all. It doesn't fail, but it produces an "image" with a nonsense chunk size. To avoid failures when an external gd >= 2.3.3 is used, we skip the test entirely in that case. --- ext/gd/tests/bug73157.phpt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/gd/tests/bug73157.phpt b/ext/gd/tests/bug73157.phpt index 95c9daf7014ac..2e9736720cd87 100644 --- a/ext/gd/tests/bug73157.phpt +++ b/ext/gd/tests/bug73157.phpt @@ -2,6 +2,12 @@ Bug #73157 (imagegd2() ignores 3rd param if 4 are given) --EXTENSIONS-- gd +--SKIPIF-- +=')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- Date: Wed, 17 May 2023 18:39:35 -0400 Subject: [PATCH 4/4] ext/gd/tests/bug77973.phpt: accept lowercase "Invalid" This test fails with an external gd because the test expects "Invalid" where upstream gd says "invalid". This commit tweaks the expected output to accept an arbitrary character in the i/I position. --- ext/gd/tests/bug77973.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/gd/tests/bug77973.phpt b/ext/gd/tests/bug77973.phpt index 38b41e1ca91f3..cd063e09000e7 100644 --- a/ext/gd/tests/bug77973.phpt +++ b/ext/gd/tests/bug77973.phpt @@ -15,7 +15,7 @@ $im = imagecreatefromxbm($filepath); var_dump($im); ?> --EXPECTF-- -Warning: imagecreatefromxbm(): Invalid XBM in %s on line %d +Warning: imagecreatefromxbm(): %cnvalid XBM in %s on line %d Warning: imagecreatefromxbm(): "%s" is not a valid XBM file in %s on line %d bool(false)