Commit 5bd18e3fdc1 for php.net

commit 5bd18e3fdc1abdedd5c418095fd8a41f77bae146
Author: Gina Peter Banyard <girgias@php.net>
Date:   Sat Jun 21 18:03:50 2025 +0100

    ext/zlib: Refactor tests (#18887)

    - Use INI sections
    - Use CGI sections
    - Move data into a subfolder
    - Remove ZPP tests
    - Fix various bugs within tests
    - Simplify some


    Found while working on #18879

diff --git a/ext/zlib/tests/002.phpt b/ext/zlib/tests/002.phpt
index 83f701e5aaf..6564cc3f073 100644
--- a/ext/zlib/tests/002.phpt
+++ b/ext/zlib/tests/002.phpt
@@ -8,14 +8,14 @@
 $packed=gzcompress($original);
 echo strlen($packed)." ".strlen($original)."\n";
 $unpacked=gzuncompress($packed);
-if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
+if ($original === $unpacked) echo "Strings are equal\n";

 /* with explicit compression level, length */
 $original = str_repeat("hallo php",4096);
 $packed=gzcompress($original, 9);
 echo strlen($packed)." ".strlen($original)."\n";
 $unpacked=gzuncompress($packed, 40000);
-if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
+if ($original === $unpacked) echo "Strings are equal\n";
 ?>
 --EXPECT--
 106 36864
diff --git a/ext/zlib/tests/003.phpt b/ext/zlib/tests/003.phpt
index 6fc5a71980b..0c731a0dfaf 100644
--- a/ext/zlib/tests/003.phpt
+++ b/ext/zlib/tests/003.phpt
@@ -7,7 +7,7 @@
 $original = str_repeat("hallo php",4096);
 $packed = gzencode($original);
 echo strlen($packed)." ".strlen($original). "\n";
-if (strcmp($original, gzdecode($packed)) == 0) echo "Strings are equal";
+if ($original === gzdecode($packed)) echo "Strings are equal\n";
 ?>
 --EXPECT--
 118 36864
diff --git a/ext/zlib/tests/bug55544-win.phpt b/ext/zlib/tests/bug55544-win.phpt
index 5c94236a2f2..11116da28b6 100644
Binary files a/ext/zlib/tests/bug55544-win.phpt and b/ext/zlib/tests/bug55544-win.phpt differ
diff --git a/ext/zlib/tests/bug60761.phpt b/ext/zlib/tests/bug60761.phpt
index 73512386943..16577f86908 100644
--- a/ext/zlib/tests/bug60761.phpt
+++ b/ext/zlib/tests/bug60761.phpt
@@ -2,14 +2,13 @@
 checks zlib compression output size is always the same
 --EXTENSIONS--
 zlib
+--INI--
+zlib.output_compression=4096
+zlib.output_compression_level=9
 --CGI--
 --FILE--
 <?php

-// the INI directives from bug #60761 report
-ini_set('zlib.output_compression', '4096');
-ini_set('zlib.output_compression_level', '9');
-
 // try to duplicate the original bug by running this as a CGI
 // test using ob_start and zlib.output_compression(or ob_gzhandler)
 // so it follows more of the original code-path than just calling
diff --git a/ext/zlib/tests/bug61139.phpt b/ext/zlib/tests/bug61139.phpt
index 1a6f2a1ac2c..b50bccb468e 100644
--- a/ext/zlib/tests/bug61139.phpt
+++ b/ext/zlib/tests/bug61139.phpt
@@ -9,7 +9,7 @@
 ?>
 --CLEAN--
 <?php
-    unlink('someFile');
+unlink('someFile');
 ?>
 --EXPECTF--
 Warning: gzopen(): gzopen failed in %s on line %d
diff --git a/ext/zlib/tests/bug71417.phpt b/ext/zlib/tests/bug71417.phpt
index 8d871a329e7..ee8b30f18e9 100644
--- a/ext/zlib/tests/bug71417.phpt
+++ b/ext/zlib/tests/bug71417.phpt
@@ -45,7 +45,7 @@ function test($case) {
     // The gzdecode() function applied to the corrupted compressed data always
     // detects the error:
     // --> gzdecode(): PHP Fatal error:  Uncaught ErrorException: gzdecode(): data error in ...
-    echo "gzdecode(): ", rawurldecode(gzdecode($compressed)), "\n";
+    echo "gzdecode(): ", rawurldecode((string) gzdecode($compressed)), "\n";

     file_put_contents($fn, $compressed);

diff --git a/ext/zlib/tests/bug74240.phpt b/ext/zlib/tests/bug74240.phpt
index c3dbcc26e36..f45cd04f71c 100644
--- a/ext/zlib/tests/bug74240.phpt
+++ b/ext/zlib/tests/bug74240.phpt
@@ -2,11 +2,11 @@
 Bug #74240 (deflate_add can allocate too much memory)
 --EXTENSIONS--
 zlib
+--INI--
+memory_limit=64M
 --FILE--
 <?php

-ini_set('memory_limit', '64M');
-
 $deflator = deflate_init(ZLIB_ENCODING_RAW);

 $bytes = str_repeat("*", 65536);
diff --git a/ext/zlib/tests/compress_zlib_wrapper.phpt b/ext/zlib/tests/compress_zlib_wrapper.phpt
index d5221cb097c..39ba238d28d 100644
--- a/ext/zlib/tests/compress_zlib_wrapper.phpt
+++ b/ext/zlib/tests/compress_zlib_wrapper.phpt
@@ -4,16 +4,14 @@
 zlib
 --FILE--
 <?php
-chdir(__DIR__. "/../../..");
-
-$pfx = str_repeat('../', substr_count($_SERVER['PHP_SELF'], '../'));
+chdir(__DIR__. "/data");

 // Relative path
-$fp = fopen("compress.zlib://{$pfx}ext/xsl/tests/xslt.xsl.gz", "rb");
+$fp = fopen("compress.zlib://test.txt.gz", "rb");
 fclose($fp);

 // Absolute path
-$fp = fopen("compress.zlib://". __DIR__. "/../../../ext/xsl/tests/xslt.xsl.gz", "rb");
+$fp = fopen("compress.zlib://". __DIR__. "/data/test.txt.gz", "rb");
 fclose($fp);

 echo "ok\n";
diff --git a/ext/zlib/tests/data.inc b/ext/zlib/tests/data/data.inc
similarity index 100%
rename from ext/zlib/tests/data.inc
rename to ext/zlib/tests/data/data.inc
diff --git a/ext/zlib/tests/func.inc b/ext/zlib/tests/data/func.inc
similarity index 100%
rename from ext/zlib/tests/func.inc
rename to ext/zlib/tests/data/func.inc
diff --git a/ext/zlib/tests/004.txt.gz b/ext/zlib/tests/data/test.txt.gz
similarity index 100%
rename from ext/zlib/tests/004.txt.gz
rename to ext/zlib/tests/data/test.txt.gz
diff --git "a/ext/zlib/tests/004\347\247\201\343\201\257\343\202\254\343\203\251\343\202\271\343\202\222\351\243\237\343\201\271\343\202\211\343\202\214\343\201\276\343\201\231.txt.gz" b/ext/zlib/tests/data/windows-test.txt.gz
similarity index 100%
rename from "ext/zlib/tests/004\347\247\201\343\201\257\343\202\254\343\203\251\343\202\271\343\202\222\351\243\237\343\201\271\343\202\211\343\202\214\343\201\276\343\201\231.txt.gz"
rename to ext/zlib/tests/data/windows-test.txt.gz
diff --git a/ext/zlib/tests/deflate_init_reuse.phpt b/ext/zlib/tests/deflate_init_reuse.phpt
index cf24f6807cf..464eac16cab 100644
--- a/ext/zlib/tests/deflate_init_reuse.phpt
+++ b/ext/zlib/tests/deflate_init_reuse.phpt
@@ -17,8 +17,9 @@
     $compressed .= deflate_add($resource, $char, ZLIB_NO_FLUSH);
 }
 $compressed .= deflate_add($resource, "", ZLIB_FINISH);
-assert($uncompressed === zlib_decode($compressed));
+var_dump($uncompressed === zlib_decode($compressed));
 ?>
 ===DONE===
 --EXPECT--
+bool(true)
 ===DONE===
diff --git a/ext/zlib/tests/gh16883.phpt b/ext/zlib/tests/gh16883.phpt
index c3d81d45379..8f22d166227 100644
--- a/ext/zlib/tests/gh16883.phpt
+++ b/ext/zlib/tests/gh16883.phpt
@@ -29,9 +29,9 @@
 $f = gzopen('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT, 'r');
 var_dump(stream_get_contents($f));

-var_dump(gzfile('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT, 'r'));
+var_dump(gzfile('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT));

-var_dump(readgzfile('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT, 'r'));
+var_dump(readgzfile('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT));

 ?>
 --EXPECT--
diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt
index c1d6edf4d95..f2e03a579de 100644
--- a/ext/zlib/tests/gzclose_basic.phpt
+++ b/ext/zlib/tests/gzclose_basic.phpt
@@ -7,7 +7,7 @@
 // note that gzclose is an alias to fclose. parameter checking tests will be
 // the same as fclose

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 gzread($h, 20);
 var_dump(gzclose($h));
diff --git a/ext/zlib/tests/gzcompress_basic1.phpt b/ext/zlib/tests/gzcompress_basic1.phpt
index 8899deaed0f..606da46e5c8 100644
--- a/ext/zlib/tests/gzcompress_basic1.phpt
+++ b/ext/zlib/tests/gzcompress_basic1.phpt
@@ -8,7 +8,7 @@
  * add a comment here to say what the test is supposed to do
  */

-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzcompress() : basic functionality ***\n";

@@ -23,68 +23,68 @@
 for($i = -1; $i < 10; $i++) {
     echo "-- Compression level $i --\n";
     $output = gzcompress($data, $i);
-    var_dump(strcmp(gzuncompress($output), $data));
+    var_dump(gzuncompress($output) === $data);
 }

 // Compressing a smaller string
 for($i = -1; $i < 10; $i++) {
     echo "-- Compression level $i --\n";
     $output = gzcompress($smallstring, $i);
-    var_dump(strcmp(gzuncompress($output), $smallstring));
+    var_dump(gzuncompress($output) === $smallstring);
 }

 // Calling gzcompress() with mandatory arguments
 echo "\n-- Testing with no specified compression level --\n";
 $output = gzcompress($smallstring);
- var_dump(strcmp(gzuncompress($output), $smallstring));
+var_dump(gzuncompress($output) === $smallstring);

 ?>
 --EXPECT--
 *** Testing gzcompress() : basic functionality ***
 -- Compression level -1 --
-int(0)
+bool(true)
 -- Compression level 0 --
-int(0)
+bool(true)
 -- Compression level 1 --
-int(0)
+bool(true)
 -- Compression level 2 --
-int(0)
+bool(true)
 -- Compression level 3 --
-int(0)
+bool(true)
 -- Compression level 4 --
-int(0)
+bool(true)
 -- Compression level 5 --
-int(0)
+bool(true)
 -- Compression level 6 --
-int(0)
+bool(true)
 -- Compression level 7 --
-int(0)
+bool(true)
 -- Compression level 8 --
-int(0)
+bool(true)
 -- Compression level 9 --
-int(0)
+bool(true)
 -- Compression level -1 --
-int(0)
+bool(true)
 -- Compression level 0 --
-int(0)
+bool(true)
 -- Compression level 1 --
-int(0)
+bool(true)
 -- Compression level 2 --
-int(0)
+bool(true)
 -- Compression level 3 --
-int(0)
+bool(true)
 -- Compression level 4 --
-int(0)
+bool(true)
 -- Compression level 5 --
-int(0)
+bool(true)
 -- Compression level 6 --
-int(0)
+bool(true)
 -- Compression level 7 --
-int(0)
+bool(true)
 -- Compression level 8 --
-int(0)
+bool(true)
 -- Compression level 9 --
-int(0)
+bool(true)

 -- Testing with no specified compression level --
-int(0)
+bool(true)
diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt
index a34ceaf7248..b2174375541 100644
--- a/ext/zlib/tests/gzcompress_error1.phpt
+++ b/ext/zlib/tests/gzcompress_error1.phpt
@@ -20,7 +20,6 @@
 }

 echo "\n-- Testing with invalid encoding --\n";
-$data = 'string_val';
 $level = 2;
 $encoding = 99;
 try {
diff --git a/ext/zlib/tests/gzcompress_variation1.phpt b/ext/zlib/tests/gzcompress_variation1.phpt
index 81dafa737c3..032a77a1a55 100644
--- a/ext/zlib/tests/gzcompress_variation1.phpt
+++ b/ext/zlib/tests/gzcompress_variation1.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzcompress() : variation ***\n";

diff --git a/ext/zlib/tests/gzdeflate_basic1.phpt b/ext/zlib/tests/gzdeflate_basic1.phpt
index efd58a24bb3..c4969a9ca3d 100644
--- a/ext/zlib/tests/gzdeflate_basic1.phpt
+++ b/ext/zlib/tests/gzdeflate_basic1.phpt
@@ -8,7 +8,7 @@
  * add a comment here to say what the test is supposed to do
  */

-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzdeflate() : basic functionality ***\n";

@@ -23,68 +23,68 @@
 for($i = -1; $i < 10; $i++) {
     echo "-- Compression level $i --\n";
     $output = gzdeflate($data, $i);
-    var_dump(strcmp(gzinflate($output), $data));
+    var_dump(gzinflate($output) === $data);
 }

 // Compressing a smaller string
 for($i = -1; $i < 10; $i++) {
     echo "-- Compression level $i --\n";
     $output = gzdeflate($smallstring, $i);
-    var_dump(strcmp(gzinflate($output), $smallstring));
+    var_dump(gzinflate($output) === $smallstring);
 }

 // Calling gzdeflate() with just mandatory arguments
 echo "\n-- Testing with no specified compression level --\n";
 $output = gzdeflate($smallstring);
-var_dump(strcmp(gzinflate($output), $smallstring));
+var_dump(gzinflate($output) === $smallstring);

 ?>
 --EXPECT--
 *** Testing gzdeflate() : basic functionality ***
 -- Compression level -1 --
-int(0)
+bool(true)
 -- Compression level 0 --
-int(0)
+bool(true)
 -- Compression level 1 --
-int(0)
+bool(true)
 -- Compression level 2 --
-int(0)
+bool(true)
 -- Compression level 3 --
-int(0)
+bool(true)
 -- Compression level 4 --
-int(0)
+bool(true)
 -- Compression level 5 --
-int(0)
+bool(true)
 -- Compression level 6 --
-int(0)
+bool(true)
 -- Compression level 7 --
-int(0)
+bool(true)
 -- Compression level 8 --
-int(0)
+bool(true)
 -- Compression level 9 --
-int(0)
+bool(true)
 -- Compression level -1 --
-int(0)
+bool(true)
 -- Compression level 0 --
-int(0)
+bool(true)
 -- Compression level 1 --
-int(0)
+bool(true)
 -- Compression level 2 --
-int(0)
+bool(true)
 -- Compression level 3 --
-int(0)
+bool(true)
 -- Compression level 4 --
-int(0)
+bool(true)
 -- Compression level 5 --
-int(0)
+bool(true)
 -- Compression level 6 --
-int(0)
+bool(true)
 -- Compression level 7 --
-int(0)
+bool(true)
 -- Compression level 8 --
-int(0)
+bool(true)
 -- Compression level 9 --
-int(0)
+bool(true)

 -- Testing with no specified compression level --
-int(0)
+bool(true)
diff --git a/ext/zlib/tests/gzdeflate_variation1.phpt b/ext/zlib/tests/gzdeflate_variation1.phpt
index 21456a98876..b2d98ce978d 100644
--- a/ext/zlib/tests/gzdeflate_variation1.phpt
+++ b/ext/zlib/tests/gzdeflate_variation1.phpt
@@ -4,12 +4,10 @@
 zlib
 --FILE--
 <?php
-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzdeflate() : variation ***\n";

-
-
 echo "\n-- Testing multiple compression --\n";
 $output = gzdeflate($data);
 var_dump(strlen($output));
diff --git a/ext/zlib/tests/gzencode_basic1.phpt b/ext/zlib/tests/gzencode_basic1.phpt
index 951e8b0e470..d98e1571e95 100644
--- a/ext/zlib/tests/gzencode_basic1.phpt
+++ b/ext/zlib/tests/gzencode_basic1.phpt
@@ -8,7 +8,7 @@
  * Test basic function of gzencode
  */

-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzencode() : basic functionality ***\n";

@@ -23,24 +23,24 @@
 for($i = -1; $i < 10; $i++) {
     echo "-- Compression level $i --\n";
     $output = gzencode($data, $i);
-    var_dump(strcmp(gzdecode($output), $data)===0);
+    var_dump(gzdecode($output) === $data);
 }

 // Compressing a smaller string
 for($i = -1; $i < 10; $i++) {
     echo "-- Compression level $i --\n";
     $output = gzencode($smallstring, $i);
-    var_dump(strcmp(gzdecode($output), $smallstring)===0);
+    var_dump(gzdecode($output) === $smallstring);
 }

 // Calling gzencode() with mandatory arguments
 echo "\n-- Testing with no specified compression level --\n";
 $output = gzencode($smallstring);
-var_dump(strcmp(gzdecode($output), $smallstring)===0);
+var_dump(gzdecode($output) === $smallstring);

 echo "\n-- Testing gzencode with mode specified --\n";
 $outupt = gzencode($smallstring, -1, FORCE_GZIP);
-var_dump(strcmp(gzdecode($output), $smallstring)===0);
+var_dump(gzdecode($output) === $smallstring);
 ?>
 --EXPECTF--
 *** Testing gzencode() : basic functionality ***
diff --git a/ext/zlib/tests/007.phpt b/ext/zlib/tests/gzencode_invalid.phpt
similarity index 100%
rename from ext/zlib/tests/007.phpt
rename to ext/zlib/tests/gzencode_invalid.phpt
diff --git a/ext/zlib/tests/gzencode_variation1-win32.phpt b/ext/zlib/tests/gzencode_variation1-win32.phpt
index 31329bb5ea9..c6d261567c9 100644
--- a/ext/zlib/tests/gzencode_variation1-win32.phpt
+++ b/ext/zlib/tests/gzencode_variation1-win32.phpt
@@ -11,7 +11,7 @@
 --FILE--
 <?php

-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzencode() : variation ***\n";

diff --git a/ext/zlib/tests/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt
index bbc6dc0c6a8..ecbda53b5b1 100644
--- a/ext/zlib/tests/gzencode_variation1.phpt
+++ b/ext/zlib/tests/gzencode_variation1.phpt
@@ -9,15 +9,13 @@
    die("skip.. Do not run on Windows");
 }

-
-
 if (PHP_OS == "Darwin") {
     print "skip - OS is encoded in headers, tested header is non Darwin";
 }
 ?>
 --FILE--
 <?php
-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzencode() : variation ***\n";

diff --git a/ext/zlib/tests/gzencode_variation2-win32.phpt b/ext/zlib/tests/gzencode_variation2-win32.phpt
index 90da1244158..2cc1f982089 100644
--- a/ext/zlib/tests/gzencode_variation2-win32.phpt
+++ b/ext/zlib/tests/gzencode_variation2-win32.phpt
@@ -4,14 +4,10 @@
 zlib
 --SKIPIF--
 <?php
-
 if( substr(PHP_OS, 0, 3) != "WIN" ) {
   die("skip.. only for Windows");
 }
-
-
-
-include 'func.inc';
+include 'data/func.inc';
 if (version_compare(get_zlib_version(), "1.2.11") < 0) {
     die("skip - at least zlib 1.2.11 required, got " . get_zlib_version());
 }
diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt
index 2e4057ac101..096eec57708 100644
--- a/ext/zlib/tests/gzencode_variation2.phpt
+++ b/ext/zlib/tests/gzencode_variation2.phpt
@@ -4,13 +4,9 @@
 zlib
 --SKIPIF--
 <?php
-
 if( substr(PHP_OS, 0, 3) == "WIN" ) {
   die("skip.. Do not run on Windows");
 }
-
-
-
 if (PHP_OS == "Darwin") {
     print "skip - OS is encoded in headers, tested header is non Darwin";
 }
diff --git a/ext/zlib/tests/gzeof_basic.phpt b/ext/zlib/tests/gzeof_basic.phpt
index c41242172de..1dfa9287216 100644
--- a/ext/zlib/tests/gzeof_basic.phpt
+++ b/ext/zlib/tests/gzeof_basic.phpt
@@ -7,7 +7,7 @@
 // note that gzeof is an alias to gzeof. parameter checking tests will be
 // the same as gzeof

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";

 echo "-- test 1 --\n";
 $h = gzopen($f, 'r');
diff --git a/ext/zlib/tests/004.phpt b/ext/zlib/tests/gzfile-mb.phpt
similarity index 74%
rename from ext/zlib/tests/004.phpt
rename to ext/zlib/tests/gzfile-mb.phpt
index 96026bfa57a..e395e6d9c16 100644
--- a/ext/zlib/tests/004.phpt
+++ b/ext/zlib/tests/gzfile-mb.phpt
@@ -5,16 +5,12 @@
 --FILE--
 <?php

-var_dump(gzfile("nonexistent_file_gzfile",1));
-
-var_dump(gzfile(__DIR__."/004.txt.gz"));
-var_dump(gzfile(__DIR__."/004.txt.gz", 1));
+var_dump(gzfile(__DIR__."/gzfile-mb私はガラスを食べられます.txt.gz"));
+var_dump(gzfile(__DIR__."/gzfile-mb私はガラスを食べられます.txt.gz", true));

 echo "Done\n";
 ?>
---EXPECTF--
-Warning: gzfile(nonexistent_file_gzfile): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
+--EXPECT--
 array(6) {
   [0]=>
   string(36) "When you're taught through feelings
diff --git a/ext/zlib/tests/005.txt.gz "b/ext/zlib/tests/gzfile-mb\347\247\201\343\201\257\343\202\254\343\203\251\343\202\271\343\202\222\351\243\237\343\201\271\343\202\211\343\202\214\343\201\276\343\201\231.txt.gz"
similarity index 100%
rename from ext/zlib/tests/005.txt.gz
rename to "ext/zlib/tests/gzfile-mb\347\247\201\343\201\257\343\202\254\343\203\251\343\202\271\343\202\222\351\243\237\343\201\271\343\202\211\343\202\214\343\201\276\343\201\231.txt.gz"
diff --git a/ext/zlib/tests/gzfile_basic.phpt b/ext/zlib/tests/gzfile_basic.phpt
index 26cde7397ce..a993893c1dc 100644
--- a/ext/zlib/tests/gzfile_basic.phpt
+++ b/ext/zlib/tests/gzfile_basic.phpt
@@ -19,8 +19,13 @@

 var_dump(gzfile( $filename ) );

-unlink($filename);
-rmdir($dirname);
+?>
+--CLEAN--
+<?php
+$dirname = 'gzfile_temp';
+$filename = $dirname.'/gzfile_basic.txt.gz';
+@unlink($filename);
+@rmdir($dirname);
 ?>
 --EXPECT--
 array(3) {
diff --git a/ext/zlib/tests/gzfile_basic2.phpt b/ext/zlib/tests/gzfile_basic2.phpt
index 2b59656a6f3..b098692620a 100644
--- a/ext/zlib/tests/gzfile_basic2.phpt
+++ b/ext/zlib/tests/gzfile_basic2.phpt
@@ -19,8 +19,13 @@

 var_dump(gzfile( $filename ) );

-unlink($filename);
-rmdir($dirname);
+?>
+--CLEAN--
+<?php
+$dirname = 'gzfile_temp2';
+$filename = $dirname.'/gzfile_basic2.txt';
+@unlink($filename);
+@rmdir($dirname);
 ?>
 --EXPECT--
 array(3) {
diff --git a/ext/zlib/tests/004-mb.phpt b/ext/zlib/tests/gzfile_open_gz.phpt
similarity index 66%
rename from ext/zlib/tests/004-mb.phpt
rename to ext/zlib/tests/gzfile_open_gz.phpt
index 9cf6dd628c6..7614a3ddcac 100644
--- a/ext/zlib/tests/004-mb.phpt
+++ b/ext/zlib/tests/gzfile_open_gz.phpt
@@ -1,20 +1,16 @@
 --TEST--
-gzfile() with various invalid params
+gzfile() with a proper gz file
 --EXTENSIONS--
 zlib
 --FILE--
 <?php

-var_dump(gzfile("nonexistent_file_gzfile",1));
-
-var_dump(gzfile(__DIR__."/004私はガラスを食べられます.txt.gz"));
-var_dump(gzfile(__DIR__."/004私はガラスを食べられます.txt.gz", 1));
+var_dump(gzfile(__DIR__."/data/test.txt.gz"));
+var_dump(gzfile(__DIR__."/data/test.txt.gz", true));

 echo "Done\n";
 ?>
---EXPECTF--
-Warning: gzfile(nonexistent_file_gzfile): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
+--EXPECT--
 array(6) {
   [0]=>
   string(36) "When you're taught through feelings
diff --git a/ext/zlib/tests/gzfile_variation12.phpt b/ext/zlib/tests/gzfile_variation12.phpt
deleted file mode 100644
index 6985442d6e5..00000000000
--- a/ext/zlib/tests/gzfile_variation12.phpt
+++ /dev/null
@@ -1,104 +0,0 @@
---TEST--
-Test function gzfile() by substituting argument 2 with int values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$filename = __DIR__."/004.txt.gz";
-
-
-$variation = array (
-    'int 0' => 0,
-    'int 1' => 1,
-    'int 12345' => 12345,
-    'int -12345' => -2345,
-    );
-
-
-foreach ( $variation as $var ) {
-  var_dump(gzfile( $filename, $var  ) );
-}
-?>
---EXPECT--
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
diff --git a/ext/zlib/tests/gzfile_variation4.phpt b/ext/zlib/tests/gzfile_variation4.phpt
deleted file mode 100644
index 86d84899b86..00000000000
--- a/ext/zlib/tests/gzfile_variation4.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-Test function gzfile() by substituting argument 1 with float values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$use_include_path = false;
-
-
-$variation = array(
-  'float 10.5' => 10.5,
-  'float -10.5' => -10.5,
-  'float 12.3456789000e10' => 12.3456789000e10,
-  'float -12.3456789000e10' => -12.3456789000e10,
-  'float .5' => .5,
-  );
-
-
-foreach ( $variation as $var ) {
-  var_dump(gzfile( $var ,  $use_include_path ) );
-}
-?>
---EXPECTF--
-Warning: gzfile(10.5): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(-10.5): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(123456789000): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(-123456789000): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(0.5): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
diff --git a/ext/zlib/tests/gzfile_variation5.phpt b/ext/zlib/tests/gzfile_variation5.phpt
deleted file mode 100644
index 75751ea12cc..00000000000
--- a/ext/zlib/tests/gzfile_variation5.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Test function gzfile() by substituting argument 1 with int values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$use_include_path = false;
-
-
-$variation = array (
-    'int 0' => 0,
-    'int 1' => 1,
-    'int 12345' => 12345,
-    'int -12345' => -2345,
-    );
-
-
-foreach ( $variation as $var ) {
-  var_dump(gzfile( $var ,  $use_include_path ) );
-}
-?>
---EXPECTF--
-Warning: gzfile(0): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(1): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(12345): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(-2345): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
diff --git a/ext/zlib/tests/gzfile_variation7.phpt b/ext/zlib/tests/gzfile_variation7.phpt
index 834f8937e82..ca221c12cff 100644
--- a/ext/zlib/tests/gzfile_variation7.phpt
+++ b/ext/zlib/tests/gzfile_variation7.phpt
@@ -1,39 +1,18 @@
 --TEST--
-Test function gzfile() by substituting argument 1 with string values.
+gzfile() with unknown file
 --EXTENSIONS--
 zlib
 --FILE--
 <?php

+$filename = "nonexistent_file_gzfile.txt.gz";

-$use_include_path = false;
-
-
-$heredoc = <<<EOT
-hello world
-EOT;
-
-$variation_array = array(
-  'string DQ' => "string",
-  'string SQ' => 'string',
-  'mixed case string' => "sTrInG",
-  'heredoc' => $heredoc
-  );
-
-
-foreach ( $variation_array as $var ) {
-  var_dump(gzfile( $var ,  $use_include_path ) );
-}
+var_dump(gzfile($filename, false));
+var_dump(gzfile($filename, true));
 ?>
 --EXPECTF--
-Warning: gzfile(string): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(string): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: gzfile(sTrInG): Failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(nonexistent_file_gzfile.txt.gz): Failed to open stream: No such file or directory in %s on line %d
 bool(false)

-Warning: gzfile(hello world): Failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(nonexistent_file_gzfile.txt.gz): Failed to open stream: No such file or directory in %s on line %d
 bool(false)
diff --git a/ext/zlib/tests/gzfile_variation9.phpt b/ext/zlib/tests/gzfile_variation9.phpt
deleted file mode 100644
index f2919d79be5..00000000000
--- a/ext/zlib/tests/gzfile_variation9.phpt
+++ /dev/null
@@ -1,103 +0,0 @@
---TEST--
-Test function gzfile() by substituting argument 2 with boolean values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$filename = __DIR__."/004.txt.gz";
-
-$variation = array(
-  'lowercase true' => true,
-  'lowercase false' =>false,
-  'uppercase TRUE' =>TRUE,
-  'uppercase FALSE' =>FALSE,
-  );
-
-
-foreach ( $variation as $var ) {
-  var_dump(gzfile( $filename, $var  ) );
-}
-?>
---EXPECT--
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
-array(6) {
-  [0]=>
-  string(36) "When you're taught through feelings
-"
-  [1]=>
-  string(26) "Destiny flying high above
-"
-  [2]=>
-  string(38) "all I know is that you can realize it
-"
-  [3]=>
-  string(18) "Destiny who cares
-"
-  [4]=>
-  string(19) "as it turns around
-"
-  [5]=>
-  string(39) "and I know that it descends down on me
-"
-}
diff --git a/ext/zlib/tests/gzgetc_basic.phpt b/ext/zlib/tests/gzgetc_basic.phpt
index 7164c23098d..ce366e4b6b3 100644
--- a/ext/zlib/tests/gzgetc_basic.phpt
+++ b/ext/zlib/tests/gzgetc_basic.phpt
@@ -4,8 +4,7 @@
 zlib
 --SKIPIF--
 <?php
-
-include 'func.inc';
+include 'data/func.inc';
 if (version_compare(get_zlib_version(), '1.2.5') > 0) {
     die('skip - only for zlib <= 1.2.5');
 }
@@ -16,7 +15,7 @@
 // note that gzgets is an alias to fgets. parameter checking tests will be
 // the same as gzgets

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');

 $count = 0;
diff --git a/ext/zlib/tests/gzgetc_basic_1.phpt b/ext/zlib/tests/gzgetc_basic_1.phpt
index e70c5814fcb..cf6da96e561 100644
--- a/ext/zlib/tests/gzgetc_basic_1.phpt
+++ b/ext/zlib/tests/gzgetc_basic_1.phpt
@@ -5,7 +5,7 @@
 --SKIPIF--
 <?php

-include 'func.inc';
+include 'data/func.inc';
 if (version_compare(get_zlib_version(), '1.2.7') < 0) {
     die('skip - only for zlib >= 1.2.7');
 }
@@ -16,7 +16,7 @@
 // note that gzgets is an alias to fgets. parameter checking tests will be
 // the same as gzgets

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 if ($h) {
     $count = 0;
diff --git a/ext/zlib/tests/gzgets_basic.phpt b/ext/zlib/tests/gzgets_basic.phpt
index f43b3ad5342..a971d5e3a62 100644
--- a/ext/zlib/tests/gzgets_basic.phpt
+++ b/ext/zlib/tests/gzgets_basic.phpt
@@ -8,7 +8,7 @@
 // note that gzgets is an alias to fgets. parameter checking tests will be
 // the same as fgets

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 $lengths = array(10, 14, 7, 99);
 foreach ($lengths as $length) {
diff --git a/ext/zlib/tests/gzinflate_error1.phpt b/ext/zlib/tests/gzinflate_error1.phpt
index 8d4abdf529b..4d02c2604e3 100644
--- a/ext/zlib/tests/gzinflate_error1.phpt
+++ b/ext/zlib/tests/gzinflate_error1.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzinflate() : error conditions ***\n";

diff --git a/ext/zlib/tests/gzinflate_length.phpt b/ext/zlib/tests/gzinflate_length.phpt
index 5ab58c4a052..78826be7169 100644
--- a/ext/zlib/tests/gzinflate_length.phpt
+++ b/ext/zlib/tests/gzinflate_length.phpt
@@ -8,10 +8,10 @@
 $packed=gzdeflate($original);
 echo strlen($packed)." ".strlen($original)."\n";
 $unpacked=gzinflate($packed, strlen($original));
-if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
+if ($original === $unpacked) echo "Strings are equal\n";

 $unpacked=gzinflate($packed, strlen($original)*10);
-if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
+if ($original === $unpacked) echo "Strings are equal\n";

 $unpacked=gzinflate($packed, 1);
 if ($unpacked === false) echo "Failed (as expected)\n";
diff --git a/ext/zlib/tests/gzopen_basic.phpt b/ext/zlib/tests/gzopen_basic.phpt
index a4ded39b78e..8ada611961b 100644
--- a/ext/zlib/tests/gzopen_basic.phpt
+++ b/ext/zlib/tests/gzopen_basic.phpt
@@ -8,7 +8,7 @@


 // Initialise all required variables
-$filename = __DIR__."/004.txt.gz";
+$filename = __DIR__."/data/test.txt.gz";
 $mode = 'r';
 $use_include_path = false;

diff --git a/ext/zlib/tests/gzopen_variation7.phpt b/ext/zlib/tests/gzopen_variation7.phpt
index e018a7b7f46..71c431ce1ed 100644
--- a/ext/zlib/tests/gzopen_variation7.phpt
+++ b/ext/zlib/tests/gzopen_variation7.phpt
@@ -5,7 +5,7 @@
 --FILE--
 <?php

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h1 = gzopen($f, 'r');
 $h2 = gzopen($f, 'r');

diff --git a/ext/zlib/tests/gzopen_variation9.phpt b/ext/zlib/tests/gzopen_variation9.phpt
index 27198378bd4..f9ac099dc25 100644
--- a/ext/zlib/tests/gzopen_variation9.phpt
+++ b/ext/zlib/tests/gzopen_variation9.phpt
@@ -8,7 +8,7 @@

 $modes = array('r+', 'rf', 'w+' , 'e');

-$file = __DIR__."/004.txt.gz";
+$file = __DIR__."/data/test.txt.gz";

 foreach ($modes as $mode) {
     echo "mode=$mode\n";
@@ -38,6 +38,6 @@

 mode=e

-Warning: gzopen(%s/004.txt.gz): Failed to open stream: %s in %s on line %d
+Warning: gzopen(%s/test.txt.gz): Failed to open stream: %s in %s on line %d
 gzopen=bool(false)

diff --git a/ext/zlib/tests/gzpassthru_basic.phpt b/ext/zlib/tests/gzpassthru_basic.phpt
index 11a57301c0a..8b2fd701bc2 100644
--- a/ext/zlib/tests/gzpassthru_basic.phpt
+++ b/ext/zlib/tests/gzpassthru_basic.phpt
@@ -8,7 +8,7 @@
 // note that gzpassthru is an alias to fpassthru. parameter checking tests will be
 // the same as fpassthru

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 var_dump(gzpassthru($h));
 var_dump(gzpassthru($h));
diff --git a/ext/zlib/tests/gzread_basic.phpt b/ext/zlib/tests/gzread_basic.phpt
index 35e65fd0400..9efb0c0b5d0 100644
--- a/ext/zlib/tests/gzread_basic.phpt
+++ b/ext/zlib/tests/gzread_basic.phpt
@@ -7,7 +7,7 @@
 // note that gzread is an alias to fread. parameter checking tests will be
 // the same as fread

-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 $lengths = array(10, 14, 7, 99, 2000);

diff --git a/ext/zlib/tests/gzread_error2.phpt b/ext/zlib/tests/gzread_error2.phpt
index 88cb41d4845..0a3d08efd09 100644
--- a/ext/zlib/tests/gzread_error2.phpt
+++ b/ext/zlib/tests/gzread_error2.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 var_dump(gzread($h, 10));
 try {
diff --git a/ext/zlib/tests/gzrewind_basic.phpt b/ext/zlib/tests/gzrewind_basic.phpt
index c923477077a..3ac4361caef 100644
--- a/ext/zlib/tests/gzrewind_basic.phpt
+++ b/ext/zlib/tests/gzrewind_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 echo "test rewind before doing anything\n";
 var_dump(gzrewind($h));
diff --git a/ext/zlib/tests/gzrewind_basic2.phpt b/ext/zlib/tests/gzrewind_basic2.phpt
index 7812a4899fb..17660e842d8 100644
--- a/ext/zlib/tests/gzrewind_basic2.phpt
+++ b/ext/zlib/tests/gzrewind_basic2.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');

 // read to the end of the file
diff --git a/ext/zlib/tests/gzseek_basic.phpt b/ext/zlib/tests/gzseek_basic.phpt
index ddc872ca749..5d7d2fe5279 100644
--- a/ext/zlib/tests/gzseek_basic.phpt
+++ b/ext/zlib/tests/gzseek_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');

 echo "move to the 50th byte\n";
diff --git a/ext/zlib/tests/gzseek_variation2.phpt b/ext/zlib/tests/gzseek_variation2.phpt
index 717c484c8ea..8a41b07bd36 100644
--- a/ext/zlib/tests/gzseek_variation2.phpt
+++ b/ext/zlib/tests/gzseek_variation2.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');

 echo "move to the 50th byte\n";
diff --git a/ext/zlib/tests/gzseek_variation3.phpt b/ext/zlib/tests/gzseek_variation3.phpt
index 87088d1b993..70bfde8f6f4 100644
--- a/ext/zlib/tests/gzseek_variation3.phpt
+++ b/ext/zlib/tests/gzseek_variation3.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');

 echo "move to the 50th byte\n";
diff --git a/ext/zlib/tests/gzseek_variation6.phpt b/ext/zlib/tests/gzseek_variation6.phpt
index 45071193578..58994ada56a 100644
--- a/ext/zlib/tests/gzseek_variation6.phpt
+++ b/ext/zlib/tests/gzseek_variation6.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 // move 40 bytes
 echo "move 40 bytes\n";
diff --git a/ext/zlib/tests/gztell_basic.phpt b/ext/zlib/tests/gztell_basic.phpt
index e05caf8680e..621709d443f 100644
--- a/ext/zlib/tests/gztell_basic.phpt
+++ b/ext/zlib/tests/gztell_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, 'r');
 $intervals = array(7, 22, 54, 17, 27, 15, 1000);
 // tell should be 7, 29, 83, 100, 127, 142, 176 (176 is length of uncompressed file)
diff --git a/ext/zlib/tests/gzuncompress_basic1.phpt b/ext/zlib/tests/gzuncompress_basic1.phpt
index c2bffe4efc9..9f3b6a0e099 100644
--- a/ext/zlib/tests/gzuncompress_basic1.phpt
+++ b/ext/zlib/tests/gzuncompress_basic1.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-include(__DIR__ . '/data.inc');
+include(__DIR__ . '/data/data.inc');

 echo "*** Testing gzuncompress() : basic functionality ***\n";

diff --git a/ext/zlib/tests/gzwrite_variation1.phpt b/ext/zlib/tests/gzwrite_variation1.phpt
index 22ba9135115..3eddbdc96ab 100644
--- a/ext/zlib/tests/gzwrite_variation1.phpt
+++ b/ext/zlib/tests/gzwrite_variation1.phpt
@@ -5,7 +5,7 @@
 --FILE--
 <?php

-$filename = __DIR__."/004.txt.gz";
+$filename = __DIR__."/data/test.txt.gz";
 $h = gzopen($filename, 'r');
 $str = "Here is the string to be written. ";
 $length = 10;
diff --git a/ext/zlib/tests/ob_001.phpt b/ext/zlib/tests/ob_001.phpt
index 9f2cf7a74a3..6d42d3e592a 100644
--- a/ext/zlib/tests/ob_001.phpt
+++ b/ext/zlib/tests/ob_001.phpt
@@ -3,9 +3,7 @@
 --EXTENSIONS--
 zlib
 --SKIPIF--
-<?php
-if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
-?>
+--CGI--
 --GET--
 a=b
 --INI--
diff --git a/ext/zlib/tests/ob_003.phpt b/ext/zlib/tests/ob_003.phpt
index 647a1206270..70bd209f382 100644
--- a/ext/zlib/tests/ob_003.phpt
+++ b/ext/zlib/tests/ob_003.phpt
@@ -3,9 +3,7 @@
 --EXTENSIONS--
 zlib
 --SKIPIF--
-<?php
-if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
-?>
+--CGI--
 --INI--
 zlib.output_compression=0
 --ENV--
diff --git a/ext/zlib/tests/ob_004.phpt b/ext/zlib/tests/ob_004.phpt
index ac4ec2d862d..dc48c39aa1f 100644
--- a/ext/zlib/tests/ob_004.phpt
+++ b/ext/zlib/tests/ob_004.phpt
@@ -3,9 +3,7 @@
 --EXTENSIONS--
 zlib
 --SKIPIF--
-<?php
-if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
-?>
+--CGI--
 --INI--
 zlib.output_compression=0
 --ENV--
diff --git a/ext/zlib/tests/ob_005.phpt b/ext/zlib/tests/ob_005.phpt
index aaa9856dbaa..343d5481618 100644
--- a/ext/zlib/tests/ob_005.phpt
+++ b/ext/zlib/tests/ob_005.phpt
@@ -2,10 +2,7 @@
 ob_gzhandler
 --EXTENSIONS--
 zlib
---SKIPIF--
-<?php
-if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
-?>
+--CGI-
 --INI--
 zlib.output_compression=0
 --ENV--
diff --git a/ext/zlib/tests/ob_gzhandler_legacy_002.phpt b/ext/zlib/tests/ob_gzhandler_legacy_002.phpt
index 6789ba2d53f..41cdda1f8d6 100644
--- a/ext/zlib/tests/ob_gzhandler_legacy_002.phpt
+++ b/ext/zlib/tests/ob_gzhandler_legacy_002.phpt
@@ -2,10 +2,7 @@
 ob_gzhandler legacy
 --EXTENSIONS--
 zlib
---SKIPIF--
-<?php
-if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
-?>
+--CGI--
 --INI--
 zlib.output_compression=0
 --ENV--
diff --git a/ext/zlib/tests/readgzfile_variation12.phpt b/ext/zlib/tests/readgzfile_variation12.phpt
deleted file mode 100644
index 02c18fc41f8..00000000000
--- a/ext/zlib/tests/readgzfile_variation12.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-Test function readgzfile() by substituting argument 2 with int values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$filename = __DIR__."/004.txt.gz";
-
-
-$variation = array (
-    'int 0' => 0,
-    'int 1' => 1,
-    'int 12345' => 12345,
-    'int -12345' => -2345,
-    );
-
-
-foreach ( $variation as $var ) {
-  var_dump(readgzfile( $filename, $var  ) );
-}
-?>
---EXPECT--
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
diff --git a/ext/zlib/tests/readgzfile_variation4.phpt b/ext/zlib/tests/readgzfile_variation4.phpt
deleted file mode 100644
index 85854b024fc..00000000000
--- a/ext/zlib/tests/readgzfile_variation4.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-Test function readgzfile() by substituting argument 1 with float values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$use_include_path = false;
-
-
-$variation = array(
-  'float 10.5' => 10.5,
-  'float -10.5' => -10.5,
-  'float 12.3456789000e10' => 12.3456789000e10,
-  'float -12.3456789000e10' => -12.3456789000e10,
-  'float .5' => .5,
-  );
-
-
-foreach ( $variation as $var ) {
-  var_dump(readgzfile( $var ,  $use_include_path ) );
-}
-?>
---EXPECTF--
-Warning: readgzfile(10.5): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(-10.5): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(123456789000): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(-123456789000): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(0.5): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
diff --git a/ext/zlib/tests/readgzfile_variation5.phpt b/ext/zlib/tests/readgzfile_variation5.phpt
deleted file mode 100644
index 039812ba2e8..00000000000
--- a/ext/zlib/tests/readgzfile_variation5.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Test function readgzfile() by substituting argument 1 with int values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$use_include_path = false;
-
-
-$variation = array (
-    'int 0' => 0,
-    'int 1' => 1,
-    'int 12345' => 12345,
-    'int -12345' => -2345,
-    );
-
-
-foreach ( $variation as $var ) {
-  var_dump(readgzfile( $var ,  $use_include_path ) );
-}
-?>
---EXPECTF--
-Warning: readgzfile(0): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(1): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(12345): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(-2345): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
diff --git a/ext/zlib/tests/readgzfile_variation7.phpt b/ext/zlib/tests/readgzfile_variation7.phpt
index 0d357c6774b..6f201abe236 100644
--- a/ext/zlib/tests/readgzfile_variation7.phpt
+++ b/ext/zlib/tests/readgzfile_variation7.phpt
@@ -1,39 +1,17 @@
 --TEST--
-Test function readgzfile() by substituting argument 1 with string values.
+readgzfile() with unknown file
 --EXTENSIONS--
 zlib
 --FILE--
 <?php

-
-$use_include_path = false;
-
-
-$heredoc = <<<EOT
-hello world
-EOT;
-
-$variation_array = array(
-  'string DQ' => "string",
-  'string SQ' => 'string',
-  'mixed case string' => "sTrInG",
-  'heredoc' => $heredoc
-  );
-
-
-foreach ( $variation_array as $var ) {
-  var_dump(readgzfile( $var ,  $use_include_path ) );
-}
+$file = "unknown_file.txt.gz";
+var_dump(readgzfile($file, false));
+var_dump(readgzfile($file, true));
 ?>
 --EXPECTF--
-Warning: readgzfile(string): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(string): Failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: readgzfile(sTrInG): Failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(unknown_file.txt.gz): Failed to open stream: No such file or directory in %s on line %d
 bool(false)

-Warning: readgzfile(hello world): Failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(unknown_file.txt.gz): Failed to open stream: No such file or directory in %s on line %d
 bool(false)
diff --git a/ext/zlib/tests/readgzfile_variation9.phpt b/ext/zlib/tests/readgzfile_variation9.phpt
deleted file mode 100644
index 011ded054b7..00000000000
--- a/ext/zlib/tests/readgzfile_variation9.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-Test function readgzfile() by substituting argument 2 with boolean values.
---EXTENSIONS--
-zlib
---FILE--
-<?php
-
-
-$filename = __DIR__."/004.txt.gz";
-
-$variation = array(
-  'lowercase true' => true,
-  'lowercase false' =>false,
-  'uppercase TRUE' =>TRUE,
-  'uppercase FALSE' =>FALSE,
-  );
-
-
-foreach ( $variation as $var ) {
-  var_dump(readgzfile( $filename, $var  ) );
-}
-?>
---EXPECT--
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
diff --git a/ext/zlib/tests/zlib_lock_mandatory_windows.phpt b/ext/zlib/tests/zlib_lock_mandatory_windows.phpt
index 04ed2ab2510..4cb8df4f2ad 100644
--- a/ext/zlib/tests/zlib_lock_mandatory_windows.phpt
+++ b/ext/zlib/tests/zlib_lock_mandatory_windows.phpt
@@ -10,7 +10,7 @@
 <?php

 echo "without wrapper\n";
-$f = __DIR__."/005.txt.gz";
+$f = __DIR__."/data/windows-test.txt.gz";
 $h = gzopen($f,'r');
 $h2 = gzopen($f, 'r');
 stream_set_chunk_size($h2,1);
@@ -23,9 +23,9 @@
 gzclose($h2);

 echo "\nwith wrapper\n";
-$f = "compress.zlib://".__DIR__."/005.txt.gz";
-$h = fopen($f,'r');
-$h2 = fopen($f, 'r');
+$f2 = "compress.zlib://".$f;
+$h = fopen($f2,'r');
+$h2 = fopen($f2, 'r');
 stream_set_chunk_size($h2, 1);

 var_dump(flock($h, LOCK_EX));
diff --git a/ext/zlib/tests/zlib_scheme_copy_basic.phpt b/ext/zlib/tests/zlib_scheme_copy_basic.phpt
index 139296247e1..80fa9e31fde 100644
--- a/ext/zlib/tests/zlib_scheme_copy_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_copy_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $outputFileName = __FILE__.'.tmp';

 $srcFile = "compress.zlib://$inputFileName";
diff --git a/ext/zlib/tests/zlib_scheme_copy_variation1.phpt b/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
index 21425375aae..eed869ce56e 100644
--- a/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
+++ b/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $outputFileName = __FILE__.'.tmp';

 $srcFile = "compress.zlib://$inputFileName";
diff --git a/ext/zlib/tests/zlib_scheme_file_basic.phpt b/ext/zlib/tests/zlib_scheme_file_basic.phpt
index 8d16ffdb586..f846f4ca9f6 100644
--- a/ext/zlib/tests/zlib_scheme_file_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 $contents = file($srcFile);
 var_dump($contents);
diff --git a/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt b/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
index 6c9991574c2..fe11d612d56 100644
--- a/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 $contents = file_get_contents($srcFile);
 echo $contents;
diff --git a/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt b/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
index 0e65ab5178b..37cb2c432d0 100644
--- a/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 readfile($srcFile);
 ?>
diff --git a/ext/zlib/tests/zlib_scheme_fopen_basic.phpt b/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
index 9d366670f1c..fbac2f82ae6 100644
--- a/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 $h = fopen($srcFile, 'r');
 fpassthru($h);
diff --git a/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt b/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
index b009b179363..e2efae42b90 100644
--- a/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
+++ b/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "file://$inputFileName";
 $compressedFile = "compress.zlib://$srcFile";

@@ -14,7 +14,7 @@
 fclose($h);
 ?>
 --EXPECTF--
-file=compress.zlib://file://%s/004.txt.gz
+file=compress.zlib://file://%s/test.txt.gz

 When you're taught through feelings
 Destiny flying high above
diff --git a/ext/zlib/tests/zlib_scheme_rename_basic.phpt b/ext/zlib/tests/zlib_scheme_rename_basic.phpt
index be9df167220..506ac9cb923 100644
--- a/ext/zlib/tests/zlib_scheme_rename_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_rename_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 rename($srcFile, 'something.tmp');
 var_dump(file_exists($inputFileName));
diff --git a/ext/zlib/tests/zlib_scheme_stat_basic2.phpt b/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
index dfe68d032d8..477ade70336 100644
--- a/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
+++ b/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 echo "file_exists=";
 var_dump(file_exists($srcFile));
@@ -30,11 +30,11 @@
 is_readable=bool(false)

 filesize=
-Warning: filesize(): stat failed for compress.zlib://%s004.txt.gz in %s on line %d
+Warning: filesize(): stat failed for compress.zlib://%stest.txt.gz in %s on line %d
 bool(false)
 filetype=
-Warning: filetype(): Lstat failed for compress.zlib://%s004.txt.gz in %s on line %d
+Warning: filetype(): Lstat failed for compress.zlib://%stest.txt.gz in %s on line %d
 bool(false)
 fileatime=
-Warning: fileatime(): stat failed for compress.zlib://%s004.txt.gz in %s on line %d
+Warning: fileatime(): stat failed for compress.zlib://%stest.txt.gz in %s on line %d
 bool(false)
diff --git a/ext/zlib/tests/zlib_scheme_unlink_basic.phpt b/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
index fa395cf1e97..0419fc66356 100644
--- a/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$inputFileName = __DIR__."/004.txt.gz";
+$inputFileName = __DIR__."/data/test.txt.gz";
 $srcFile = "compress.zlib://$inputFileName";
 unlink($srcFile);
 var_dump(file_exists($inputFileName));
diff --git a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
index 89656c7fca6..3d7c72c84cd 100644
--- a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f,'r');
 var_dump(flock($h, LOCK_EX));
 gzclose($h);
diff --git a/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt b/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
index 280f44340b3..451f8c6458c 100644
--- a/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f, "r");
 var_dump(fstat($h));
 fclose($h);
diff --git a/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt b/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
index 7ec5d378023..81fe1024cc6 100644
--- a/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
@@ -4,7 +4,7 @@
 zlib
 --FILE--
 <?php
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $f2 = "zlib_wrapper_ftruncate_basic.txt.gz";
 copy($f, $f2);

diff --git a/ext/zlib/tests/zlib_wrapper_level.phpt b/ext/zlib/tests/zlib_wrapper_level.phpt
index 3e3a7badce1..edcbf2eebcf 100644
--- a/ext/zlib/tests/zlib_wrapper_level.phpt
+++ b/ext/zlib/tests/zlib_wrapper_level.phpt
@@ -4,7 +4,7 @@
 zlib
 --SKIPIF--
 <?php
-in_array('compress.zlib', stream_get_wrappers()) || print 'skip No zlib wrapper';
+in_array('compress.zlib', stream_get_wrappers()) || die('skip No zlib wrapper');
 ?>
 --FILE--
 <?php declare(strict_types=1);
diff --git a/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt b/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
index 91ef92c9f70..886ad9911c8 100644
--- a/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
@@ -5,13 +5,13 @@
 --FILE--
 <?php
 echo "no wrapper\n";
-$f = __DIR__."/004.txt.gz";
+$f = __DIR__."/data/test.txt.gz";
 $h = gzopen($f,'r');
 var_dump(stream_get_meta_data($h));
 gzclose($h);
 echo "\nwith wrapper\n";
-$f = "compress.zlib://".__DIR__."/004.txt.gz";
-$h = fopen($f,'r');
+$f2 = "compress.zlib://" . $f;
+$h = fopen($f2,'r');
 var_dump(stream_get_meta_data($h));
 gzclose($h);

@@ -55,5 +55,5 @@
   ["seekable"]=>
   bool(true)
   ["uri"]=>
-  string(%d) "compress.zlib://%s/004.txt.gz"
+  string(%d) "compress.zlib://%s/test.txt.gz"
 }