Skip to content

Commit 48bd0cc

Browse files
committed
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.
1 parent 8708c9d commit 48bd0cc

5 files changed

Lines changed: 4 additions & 29 deletions

File tree

ext/zlib/tests/bug55544-win.phpt

-20 Bytes
Binary file not shown.

ext/zlib/tests/func.inc

Lines changed: 0 additions & 18 deletions
This file was deleted.

ext/zlib/tests/gzencode_variation2-win32.phpt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ if( substr(PHP_OS, 0, 3) != "WIN" ) {
99
die("skip.. only for Windows");
1010
}
1111

12-
13-
14-
include 'func.inc';
15-
if (version_compare(get_zlib_version(), "1.2.11") < 0) {
16-
die("skip - at least zlib 1.2.11 required, got " . get_zlib_version());
12+
if (version_compare(ZLIB_VERSION, "1.2.11") < 0) {
13+
die("skip - at least zlib 1.2.11 required, got " . ZLIB_VERSION);
1714
}
1815
?>
1916
--FILE--

ext/zlib/tests/gzgetc_basic.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ Test function gzgetc() by calling it with its expected arguments zlib 1.2.5
44
zlib
55
--SKIPIF--
66
<?php
7-
8-
include 'func.inc';
9-
if (version_compare(get_zlib_version(), '1.2.5') > 0) {
7+
if (version_compare(ZLIB_VERSION, '1.2.5') > 0) {
108
die('skip - only for zlib <= 1.2.5');
119
}
1210
?>

ext/zlib/tests/gzgetc_basic_1.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ Test function gzgetc() by calling it with its expected arguments zlib 1.2.7
44
zlib
55
--SKIPIF--
66
<?php
7-
8-
include 'func.inc';
9-
if (version_compare(get_zlib_version(), '1.2.7') < 0) {
7+
if (version_compare(ZLIB_VERSION, '1.2.7') < 0) {
108
die('skip - only for zlib >= 1.2.7');
119
}
1210
?>

0 commit comments

Comments
 (0)