From 0b0190f059c35f474d5952b824cc1b63a78c314c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 17 May 2023 12:00:58 -0400 Subject: [PATCH] ext/gd/tests: external gd-2.3.3 compatibility. Support for the legacy "gd" image format was removed from gd-2.3.3 upstream: https://github.com/libgd/libgd/blob/master/CHANGELOG.md#233---2021-09-12 Several tests for the gd extension utilize that format, and naturally fail when gd-2.3.3 from the system is used. This commit skips those tests when the version of gd is at least 2.3.3. --- ext/gd/tests/bug38212-mb.phpt | 6 ++++++ ext/gd/tests/bug38212.phpt | 6 ++++++ ext/gd/tests/bug41442.phpt | 4 ++++ ext/gd/tests/bug71912-mb.phpt | 8 ++++++++ ext/gd/tests/bug71912.phpt | 9 +++++++-- ext/gd/tests/bug72339.phpt | 10 ++++++++-- ext/gd/tests/bug73161.phpt | 6 ++++++ ext/gd/tests/bug73868.phpt | 6 ++++++ ext/gd/tests/bug73869.phpt | 6 ++++++ ext/gd/tests/crafted_gd2.phpt | 6 ++++++ ext/gd/tests/createfromgd2.phpt | 3 +++ ext/gd/tests/gif2gd.phpt | 4 ++++ ext/gd/tests/jpg2gd-mb.phpt | 4 ++++ ext/gd/tests/jpg2gd.phpt | 4 ++++ ext/gd/tests/png2gd.phpt | 4 ++++ ext/gd/tests/xpm2gd.phpt | 4 ++++ 16 files changed, 86 insertions(+), 4 deletions(-) diff --git a/ext/gd/tests/bug38212-mb.phpt b/ext/gd/tests/bug38212-mb.phpt index 709cc6c61c5c1..90aac957c7ad8 100644 --- a/ext/gd/tests/bug38212-mb.phpt +++ b/ext/gd/tests/bug38212-mb.phpt @@ -2,6 +2,12 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters) --EXTENSIONS-- gd +--SKIPIF-- +=')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- =')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + if (!function_exists("imagegd2")) { die("skip GD2 support unavailable"); } diff --git a/ext/gd/tests/bug71912-mb.phpt b/ext/gd/tests/bug71912-mb.phpt index 59e422b875068..43456de365f87 100644 --- a/ext/gd/tests/bug71912-mb.phpt +++ b/ext/gd/tests/bug71912-mb.phpt @@ -4,6 +4,14 @@ Bug #71912 (libgd: signedness vulnerability) gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + } if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available'); ?> --FILE-- diff --git a/ext/gd/tests/bug71912.phpt b/ext/gd/tests/bug71912.phpt index b006cdc3cc4a1..75e37c8d6a3c6 100644 --- a/ext/gd/tests/bug71912.phpt +++ b/ext/gd/tests/bug71912.phpt @@ -4,8 +4,13 @@ Bug #71912 (libgd: signedness vulnerability) gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } } if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available'); ?> diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index e1c2230babb50..561a1b347b51a 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -5,8 +5,14 @@ gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } } ?> --FILE-- diff --git a/ext/gd/tests/bug73161.phpt b/ext/gd/tests/bug73161.phpt index cb43d640bd47a..06e030a9de984 100644 --- a/ext/gd/tests/bug73161.phpt +++ b/ext/gd/tests/bug73161.phpt @@ -4,6 +4,12 @@ Bug #73161 (imagecreatefromgd2() may leak memory) We're testing for a memory leak that might not even show up with valgrind. --EXTENSIONS-- gd +--SKIPIF-- +=')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- =')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- =')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- =')) { + die("skip test requires GD 2.3.2 or older"); + } +?> --FILE-- =')) { + die("skip test requires GD 2.3.2 or older"); + } if (!function_exists('imagecreatefromgd2')) die("skip gd extension not available\n"); ?> --FILE-- diff --git a/ext/gd/tests/gif2gd.phpt b/ext/gd/tests/gif2gd.phpt index 79c0c87a47973..645041b491dcc 100644 --- a/ext/gd/tests/gif2gd.phpt +++ b/ext/gd/tests/gif2gd.phpt @@ -4,6 +4,10 @@ gif --> gd1/gd2 conversion test gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + if (!function_exists("imagecreatefromgif")) { die("skip gif read support unavailable"); } diff --git a/ext/gd/tests/jpg2gd-mb.phpt b/ext/gd/tests/jpg2gd-mb.phpt index 63a6216ff0f64..a8e661a2b9004 100644 --- a/ext/gd/tests/jpg2gd-mb.phpt +++ b/ext/gd/tests/jpg2gd-mb.phpt @@ -4,6 +4,10 @@ jpeg <--> gd1/gd2 conversion test gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) { die("skip jpeg support unavailable"); } diff --git a/ext/gd/tests/jpg2gd.phpt b/ext/gd/tests/jpg2gd.phpt index ec99d4c8d0d9d..447685c320150 100644 --- a/ext/gd/tests/jpg2gd.phpt +++ b/ext/gd/tests/jpg2gd.phpt @@ -4,6 +4,10 @@ jpeg <--> gd1/gd2 conversion test gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) { die("skip jpeg support unavailable"); } diff --git a/ext/gd/tests/png2gd.phpt b/ext/gd/tests/png2gd.phpt index e2e0a57b9bf2b..34e9d27783170 100644 --- a/ext/gd/tests/png2gd.phpt +++ b/ext/gd/tests/png2gd.phpt @@ -4,6 +4,10 @@ png <--> gd1/gd2 conversion test gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) { die("skip png support unavailable"); } diff --git a/ext/gd/tests/xpm2gd.phpt b/ext/gd/tests/xpm2gd.phpt index ce9852cd62da1..f415d47f5eee7 100644 --- a/ext/gd/tests/xpm2gd.phpt +++ b/ext/gd/tests/xpm2gd.phpt @@ -4,6 +4,10 @@ xpm --> gd1/gd2 conversion test gd --SKIPIF-- =')) { + die("skip test requires GD 2.3.2 or older"); + } + if (!function_exists("imagecreatefromxpm")) { die("skip xpm read support unavailable"); }