From 26e68c43513470a6d4f50a1aaacdf15ebe89bd08 Mon Sep 17 00:00:00 2001 From: ndossche Date: Thu, 21 May 2026 11:51:47 +0200 Subject: [PATCH] zlib: fix test skipif sections Depending on the specific PHP configuration, the regex matching for the version number in get_zlib_version() can fail. On master, this results in deprecation warnings and subsequent test borks: ``` Deprecated: version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated in /work/php-src/ext/zlib/tests/gzgetc_basic.skip.php on line 3 [/work/php-src/ext/zlib/tests/gzgetc_basic.phpt] Deprecated: version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated in /work/php-src/ext/zlib/tests/gzgetc_basic_1.skip.php on line 4 ``` Since ZLIB_VERSION is a constant containing the version as a string, remove all this nonsense and just use the constant directly. --- ext/zlib/tests/bug55544-win.phpt | Bin 564 -> 532 bytes ext/zlib/tests/func.inc | 18 ------------------ ext/zlib/tests/gzencode_variation2-win32.phpt | 7 ++----- ext/zlib/tests/gzgetc_basic.phpt | 4 +--- ext/zlib/tests/gzgetc_basic_1.phpt | 4 +--- 5 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 ext/zlib/tests/func.inc diff --git a/ext/zlib/tests/bug55544-win.phpt b/ext/zlib/tests/bug55544-win.phpt index 5c94236a2f21f457485fad58085a468f96ab2e83..02a1ac8370008e4e785e99823df75894791f7549 100644 GIT binary patch delta 58 zcmdnOGKFQr9{Dr{jk46D;>`TK_~iWDg2bX!jVK>ar}!|}pkPmbzlmSHc#!#%0~sF! E0CF%C?f?J) delta 90 zcmbQjvV~>B9?QJsoYIt31@*Mjykx!1ykvE2uFNzAjk46D;>`TK_~iWDg2bX!jr7!# Z_^O=Dq (\d+\.\d+\.\d+),s', $info, $match)) { - // $version = $match[1]; - if (preg_match(',zlib(?!.*libXML).*Compiled Version (=> | --FILE-- diff --git a/ext/zlib/tests/gzgetc_basic.phpt b/ext/zlib/tests/gzgetc_basic.phpt index 7164c23098d9..3a2fbe066e91 100644 --- a/ext/zlib/tests/gzgetc_basic.phpt +++ b/ext/zlib/tests/gzgetc_basic.phpt @@ -4,9 +4,7 @@ Test function gzgetc() by calling it with its expected arguments zlib 1.2.5 zlib --SKIPIF-- 0) { +if (version_compare(ZLIB_VERSION, '1.2.5') > 0) { die('skip - only for zlib <= 1.2.5'); } ?> diff --git a/ext/zlib/tests/gzgetc_basic_1.phpt b/ext/zlib/tests/gzgetc_basic_1.phpt index e70c5814fcbc..91c3a7638574 100644 --- a/ext/zlib/tests/gzgetc_basic_1.phpt +++ b/ext/zlib/tests/gzgetc_basic_1.phpt @@ -4,9 +4,7 @@ Test function gzgetc() by calling it with its expected arguments zlib 1.2.7 zlib --SKIPIF-- = 1.2.7'); } ?>