mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
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
This commit is contained in:
committed by
GitHub
parent
89be689f77
commit
5bd18e3fdc
@@ -8,14 +8,14 @@ $original = str_repeat("hallo php",4096);
|
|||||||
$packed=gzcompress($original);
|
$packed=gzcompress($original);
|
||||||
echo strlen($packed)." ".strlen($original)."\n";
|
echo strlen($packed)." ".strlen($original)."\n";
|
||||||
$unpacked=gzuncompress($packed);
|
$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 */
|
/* with explicit compression level, length */
|
||||||
$original = str_repeat("hallo php",4096);
|
$original = str_repeat("hallo php",4096);
|
||||||
$packed=gzcompress($original, 9);
|
$packed=gzcompress($original, 9);
|
||||||
echo strlen($packed)." ".strlen($original)."\n";
|
echo strlen($packed)." ".strlen($original)."\n";
|
||||||
$unpacked=gzuncompress($packed, 40000);
|
$unpacked=gzuncompress($packed, 40000);
|
||||||
if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
|
if ($original === $unpacked) echo "Strings are equal\n";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
106 36864
|
106 36864
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ zlib
|
|||||||
$original = str_repeat("hallo php",4096);
|
$original = str_repeat("hallo php",4096);
|
||||||
$packed = gzencode($original);
|
$packed = gzencode($original);
|
||||||
echo strlen($packed)." ".strlen($original). "\n";
|
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--
|
--EXPECT--
|
||||||
118 36864
|
118 36864
|
||||||
|
|||||||
Binary file not shown.
@@ -2,14 +2,13 @@
|
|||||||
checks zlib compression output size is always the same
|
checks zlib compression output size is always the same
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
|
--INI--
|
||||||
|
zlib.output_compression=4096
|
||||||
|
zlib.output_compression_level=9
|
||||||
--CGI--
|
--CGI--
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?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
|
// try to duplicate the original bug by running this as a CGI
|
||||||
// test using ob_start and zlib.output_compression(or ob_gzhandler)
|
// test using ob_start and zlib.output_compression(or ob_gzhandler)
|
||||||
// so it follows more of the original code-path than just calling
|
// so it follows more of the original code-path than just calling
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ gzopen('someFile', 'c');
|
|||||||
?>
|
?>
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
unlink('someFile');
|
unlink('someFile');
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: gzopen(): gzopen failed in %s on line %d
|
Warning: gzopen(): gzopen failed in %s on line %d
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function test($case) {
|
|||||||
// The gzdecode() function applied to the corrupted compressed data always
|
// The gzdecode() function applied to the corrupted compressed data always
|
||||||
// detects the error:
|
// detects the error:
|
||||||
// --> gzdecode(): PHP Fatal error: Uncaught ErrorException: gzdecode(): data error in ...
|
// --> 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);
|
file_put_contents($fn, $compressed);
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
Bug #74240 (deflate_add can allocate too much memory)
|
Bug #74240 (deflate_add can allocate too much memory)
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
|
--INI--
|
||||||
|
memory_limit=64M
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
ini_set('memory_limit', '64M');
|
|
||||||
|
|
||||||
$deflator = deflate_init(ZLIB_ENCODING_RAW);
|
$deflator = deflate_init(ZLIB_ENCODING_RAW);
|
||||||
|
|
||||||
$bytes = str_repeat("*", 65536);
|
$bytes = str_repeat("*", 65536);
|
||||||
|
|||||||
@@ -4,16 +4,14 @@ compress.zlib:// wrapper
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
chdir(__DIR__. "/../../..");
|
chdir(__DIR__. "/data");
|
||||||
|
|
||||||
$pfx = str_repeat('../', substr_count($_SERVER['PHP_SELF'], '../'));
|
|
||||||
|
|
||||||
// Relative path
|
// Relative path
|
||||||
$fp = fopen("compress.zlib://{$pfx}ext/xsl/tests/xslt.xsl.gz", "rb");
|
$fp = fopen("compress.zlib://test.txt.gz", "rb");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
// Absolute path
|
// 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);
|
fclose($fp);
|
||||||
|
|
||||||
echo "ok\n";
|
echo "ok\n";
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ foreach (range("a", "z") as $char) {
|
|||||||
$compressed .= deflate_add($resource, $char, ZLIB_NO_FLUSH);
|
$compressed .= deflate_add($resource, $char, ZLIB_NO_FLUSH);
|
||||||
}
|
}
|
||||||
$compressed .= deflate_add($resource, "", ZLIB_FINISH);
|
$compressed .= deflate_add($resource, "", ZLIB_FINISH);
|
||||||
assert($uncompressed === zlib_decode($compressed));
|
var_dump($uncompressed === zlib_decode($compressed));
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
|
bool(true)
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ stream_context_set_default([
|
|||||||
$f = gzopen('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT, 'r');
|
$f = gzopen('http://'.PHP_CLI_SERVER_HOSTNAME.':'.PHP_CLI_SERVER_PORT, 'r');
|
||||||
var_dump(stream_get_contents($f));
|
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--
|
--EXPECT--
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ zlib
|
|||||||
// note that gzclose is an alias to fclose. parameter checking tests will be
|
// note that gzclose is an alias to fclose. parameter checking tests will be
|
||||||
// the same as fclose
|
// the same as fclose
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
gzread($h, 20);
|
gzread($h, 20);
|
||||||
var_dump(gzclose($h));
|
var_dump(gzclose($h));
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ zlib
|
|||||||
* add a comment here to say what the test is supposed to do
|
* 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";
|
echo "*** Testing gzcompress() : basic functionality ***\n";
|
||||||
|
|
||||||
@@ -23,68 +23,68 @@ $smallstring = "A small string to compress\n";
|
|||||||
for($i = -1; $i < 10; $i++) {
|
for($i = -1; $i < 10; $i++) {
|
||||||
echo "-- Compression level $i --\n";
|
echo "-- Compression level $i --\n";
|
||||||
$output = gzcompress($data, $i);
|
$output = gzcompress($data, $i);
|
||||||
var_dump(strcmp(gzuncompress($output), $data));
|
var_dump(gzuncompress($output) === $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compressing a smaller string
|
// Compressing a smaller string
|
||||||
for($i = -1; $i < 10; $i++) {
|
for($i = -1; $i < 10; $i++) {
|
||||||
echo "-- Compression level $i --\n";
|
echo "-- Compression level $i --\n";
|
||||||
$output = gzcompress($smallstring, $i);
|
$output = gzcompress($smallstring, $i);
|
||||||
var_dump(strcmp(gzuncompress($output), $smallstring));
|
var_dump(gzuncompress($output) === $smallstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling gzcompress() with mandatory arguments
|
// Calling gzcompress() with mandatory arguments
|
||||||
echo "\n-- Testing with no specified compression level --\n";
|
echo "\n-- Testing with no specified compression level --\n";
|
||||||
$output = gzcompress($smallstring);
|
$output = gzcompress($smallstring);
|
||||||
var_dump(strcmp(gzuncompress($output), $smallstring));
|
var_dump(gzuncompress($output) === $smallstring);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
*** Testing gzcompress() : basic functionality ***
|
*** Testing gzcompress() : basic functionality ***
|
||||||
-- Compression level -1 --
|
-- Compression level -1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 0 --
|
-- Compression level 0 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 1 --
|
-- Compression level 1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 2 --
|
-- Compression level 2 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 3 --
|
-- Compression level 3 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 4 --
|
-- Compression level 4 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 5 --
|
-- Compression level 5 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 6 --
|
-- Compression level 6 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 7 --
|
-- Compression level 7 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 8 --
|
-- Compression level 8 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 9 --
|
-- Compression level 9 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level -1 --
|
-- Compression level -1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 0 --
|
-- Compression level 0 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 1 --
|
-- Compression level 1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 2 --
|
-- Compression level 2 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 3 --
|
-- Compression level 3 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 4 --
|
-- Compression level 4 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 5 --
|
-- Compression level 5 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 6 --
|
-- Compression level 6 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 7 --
|
-- Compression level 7 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 8 --
|
-- Compression level 8 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 9 --
|
-- Compression level 9 --
|
||||||
int(0)
|
bool(true)
|
||||||
|
|
||||||
-- Testing with no specified compression level --
|
-- Testing with no specified compression level --
|
||||||
int(0)
|
bool(true)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "\n-- Testing with invalid encoding --\n";
|
echo "\n-- Testing with invalid encoding --\n";
|
||||||
$data = 'string_val';
|
|
||||||
$level = 2;
|
$level = 2;
|
||||||
$encoding = 99;
|
$encoding = 99;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test gzcompress() function : variation
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzcompress() : variation ***\n";
|
echo "*** Testing gzcompress() : variation ***\n";
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ zlib
|
|||||||
* add a comment here to say what the test is supposed to do
|
* 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";
|
echo "*** Testing gzdeflate() : basic functionality ***\n";
|
||||||
|
|
||||||
@@ -23,68 +23,68 @@ $smallstring = "A small string to compress\n";
|
|||||||
for($i = -1; $i < 10; $i++) {
|
for($i = -1; $i < 10; $i++) {
|
||||||
echo "-- Compression level $i --\n";
|
echo "-- Compression level $i --\n";
|
||||||
$output = gzdeflate($data, $i);
|
$output = gzdeflate($data, $i);
|
||||||
var_dump(strcmp(gzinflate($output), $data));
|
var_dump(gzinflate($output) === $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compressing a smaller string
|
// Compressing a smaller string
|
||||||
for($i = -1; $i < 10; $i++) {
|
for($i = -1; $i < 10; $i++) {
|
||||||
echo "-- Compression level $i --\n";
|
echo "-- Compression level $i --\n";
|
||||||
$output = gzdeflate($smallstring, $i);
|
$output = gzdeflate($smallstring, $i);
|
||||||
var_dump(strcmp(gzinflate($output), $smallstring));
|
var_dump(gzinflate($output) === $smallstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling gzdeflate() with just mandatory arguments
|
// Calling gzdeflate() with just mandatory arguments
|
||||||
echo "\n-- Testing with no specified compression level --\n";
|
echo "\n-- Testing with no specified compression level --\n";
|
||||||
$output = gzdeflate($smallstring);
|
$output = gzdeflate($smallstring);
|
||||||
var_dump(strcmp(gzinflate($output), $smallstring));
|
var_dump(gzinflate($output) === $smallstring);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
*** Testing gzdeflate() : basic functionality ***
|
*** Testing gzdeflate() : basic functionality ***
|
||||||
-- Compression level -1 --
|
-- Compression level -1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 0 --
|
-- Compression level 0 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 1 --
|
-- Compression level 1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 2 --
|
-- Compression level 2 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 3 --
|
-- Compression level 3 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 4 --
|
-- Compression level 4 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 5 --
|
-- Compression level 5 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 6 --
|
-- Compression level 6 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 7 --
|
-- Compression level 7 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 8 --
|
-- Compression level 8 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 9 --
|
-- Compression level 9 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level -1 --
|
-- Compression level -1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 0 --
|
-- Compression level 0 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 1 --
|
-- Compression level 1 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 2 --
|
-- Compression level 2 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 3 --
|
-- Compression level 3 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 4 --
|
-- Compression level 4 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 5 --
|
-- Compression level 5 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 6 --
|
-- Compression level 6 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 7 --
|
-- Compression level 7 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 8 --
|
-- Compression level 8 --
|
||||||
int(0)
|
bool(true)
|
||||||
-- Compression level 9 --
|
-- Compression level 9 --
|
||||||
int(0)
|
bool(true)
|
||||||
|
|
||||||
-- Testing with no specified compression level --
|
-- Testing with no specified compression level --
|
||||||
int(0)
|
bool(true)
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ Test gzdeflate() function : variation
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzdeflate() : variation ***\n";
|
echo "*** Testing gzdeflate() : variation ***\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "\n-- Testing multiple compression --\n";
|
echo "\n-- Testing multiple compression --\n";
|
||||||
$output = gzdeflate($data);
|
$output = gzdeflate($data);
|
||||||
var_dump(strlen($output));
|
var_dump(strlen($output));
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ zlib
|
|||||||
* Test basic function of gzencode
|
* Test basic function of gzencode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzencode() : basic functionality ***\n";
|
echo "*** Testing gzencode() : basic functionality ***\n";
|
||||||
|
|
||||||
@@ -23,24 +23,24 @@ $smallstring = "A small string to compress\n";
|
|||||||
for($i = -1; $i < 10; $i++) {
|
for($i = -1; $i < 10; $i++) {
|
||||||
echo "-- Compression level $i --\n";
|
echo "-- Compression level $i --\n";
|
||||||
$output = gzencode($data, $i);
|
$output = gzencode($data, $i);
|
||||||
var_dump(strcmp(gzdecode($output), $data)===0);
|
var_dump(gzdecode($output) === $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compressing a smaller string
|
// Compressing a smaller string
|
||||||
for($i = -1; $i < 10; $i++) {
|
for($i = -1; $i < 10; $i++) {
|
||||||
echo "-- Compression level $i --\n";
|
echo "-- Compression level $i --\n";
|
||||||
$output = gzencode($smallstring, $i);
|
$output = gzencode($smallstring, $i);
|
||||||
var_dump(strcmp(gzdecode($output), $smallstring)===0);
|
var_dump(gzdecode($output) === $smallstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling gzencode() with mandatory arguments
|
// Calling gzencode() with mandatory arguments
|
||||||
echo "\n-- Testing with no specified compression level --\n";
|
echo "\n-- Testing with no specified compression level --\n";
|
||||||
$output = gzencode($smallstring);
|
$output = gzencode($smallstring);
|
||||||
var_dump(strcmp(gzdecode($output), $smallstring)===0);
|
var_dump(gzdecode($output) === $smallstring);
|
||||||
|
|
||||||
echo "\n-- Testing gzencode with mode specified --\n";
|
echo "\n-- Testing gzencode with mode specified --\n";
|
||||||
$outupt = gzencode($smallstring, -1, FORCE_GZIP);
|
$outupt = gzencode($smallstring, -1, FORCE_GZIP);
|
||||||
var_dump(strcmp(gzdecode($output), $smallstring)===0);
|
var_dump(gzdecode($output) === $smallstring);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
*** Testing gzencode() : basic functionality ***
|
*** Testing gzencode() : basic functionality ***
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) != "WIN") {
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzencode() : variation ***\n";
|
echo "*** Testing gzencode() : variation ***\n";
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,13 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) {
|
|||||||
die("skip.. Do not run on Windows");
|
die("skip.. Do not run on Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (PHP_OS == "Darwin") {
|
if (PHP_OS == "Darwin") {
|
||||||
print "skip - OS is encoded in headers, tested header is non Darwin";
|
print "skip - OS is encoded in headers, tested header is non Darwin";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzencode() : variation ***\n";
|
echo "*** Testing gzencode() : variation ***\n";
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,10 @@ Test gzencode() function : variation - verify header contents with all encoding
|
|||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if( substr(PHP_OS, 0, 3) != "WIN" ) {
|
if( substr(PHP_OS, 0, 3) != "WIN" ) {
|
||||||
die("skip.. only for Windows");
|
die("skip.. only for Windows");
|
||||||
}
|
}
|
||||||
|
include 'data/func.inc';
|
||||||
|
|
||||||
|
|
||||||
include 'func.inc';
|
|
||||||
if (version_compare(get_zlib_version(), "1.2.11") < 0) {
|
if (version_compare(get_zlib_version(), "1.2.11") < 0) {
|
||||||
die("skip - at least zlib 1.2.11 required, got " . get_zlib_version());
|
die("skip - at least zlib 1.2.11 required, got " . get_zlib_version());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,9 @@ Test gzencode() function : variation - verify header contents with all encoding
|
|||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if( substr(PHP_OS, 0, 3) == "WIN" ) {
|
if( substr(PHP_OS, 0, 3) == "WIN" ) {
|
||||||
die("skip.. Do not run on Windows");
|
die("skip.. Do not run on Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (PHP_OS == "Darwin") {
|
if (PHP_OS == "Darwin") {
|
||||||
print "skip - OS is encoded in headers, tested header is non Darwin";
|
print "skip - OS is encoded in headers, tested header is non Darwin";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ zlib
|
|||||||
// note that gzeof is an alias to gzeof. parameter checking tests will be
|
// note that gzeof is an alias to gzeof. parameter checking tests will be
|
||||||
// the same as gzeof
|
// the same as gzeof
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
|
|
||||||
echo "-- test 1 --\n";
|
echo "-- test 1 --\n";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
|
|||||||
@@ -5,16 +5,12 @@ zlib
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
var_dump(gzfile("nonexistent_file_gzfile",1));
|
var_dump(gzfile(__DIR__."/gzfile-mb私はガラスを食べられます.txt.gz"));
|
||||||
|
var_dump(gzfile(__DIR__."/gzfile-mb私はガラスを食べられます.txt.gz", true));
|
||||||
var_dump(gzfile(__DIR__."/004.txt.gz"));
|
|
||||||
var_dump(gzfile(__DIR__."/004.txt.gz", 1));
|
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: gzfile(nonexistent_file_gzfile): Failed to open stream: No such file or directory in %s on line %d
|
|
||||||
bool(false)
|
|
||||||
array(6) {
|
array(6) {
|
||||||
[0]=>
|
[0]=>
|
||||||
string(36) "When you're taught through feelings
|
string(36) "When you're taught through feelings
|
||||||
@@ -19,8 +19,13 @@ gzclose($h);
|
|||||||
|
|
||||||
var_dump(gzfile( $filename ) );
|
var_dump(gzfile( $filename ) );
|
||||||
|
|
||||||
unlink($filename);
|
?>
|
||||||
rmdir($dirname);
|
--CLEAN--
|
||||||
|
<?php
|
||||||
|
$dirname = 'gzfile_temp';
|
||||||
|
$filename = $dirname.'/gzfile_basic.txt.gz';
|
||||||
|
@unlink($filename);
|
||||||
|
@rmdir($dirname);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
array(3) {
|
array(3) {
|
||||||
|
|||||||
@@ -19,8 +19,13 @@ fclose($h);
|
|||||||
|
|
||||||
var_dump(gzfile( $filename ) );
|
var_dump(gzfile( $filename ) );
|
||||||
|
|
||||||
unlink($filename);
|
?>
|
||||||
rmdir($dirname);
|
--CLEAN--
|
||||||
|
<?php
|
||||||
|
$dirname = 'gzfile_temp2';
|
||||||
|
$filename = $dirname.'/gzfile_basic2.txt';
|
||||||
|
@unlink($filename);
|
||||||
|
@rmdir($dirname);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
array(3) {
|
array(3) {
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
gzfile() with various invalid params
|
gzfile() with a proper gz file
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
var_dump(gzfile("nonexistent_file_gzfile",1));
|
var_dump(gzfile(__DIR__."/data/test.txt.gz"));
|
||||||
|
var_dump(gzfile(__DIR__."/data/test.txt.gz", true));
|
||||||
var_dump(gzfile(__DIR__."/004私はガラスを食べられます.txt.gz"));
|
|
||||||
var_dump(gzfile(__DIR__."/004私はガラスを食べられます.txt.gz", 1));
|
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: gzfile(nonexistent_file_gzfile): Failed to open stream: No such file or directory in %s on line %d
|
|
||||||
bool(false)
|
|
||||||
array(6) {
|
array(6) {
|
||||||
[0]=>
|
[0]=>
|
||||||
string(36) "When you're taught through feelings
|
string(36) "When you're taught through feelings
|
||||||
@@ -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
|
|
||||||
"
|
|
||||||
}
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -1,39 +1,18 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test function gzfile() by substituting argument 1 with string values.
|
gzfile() with unknown file
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$filename = "nonexistent_file_gzfile.txt.gz";
|
||||||
|
|
||||||
$use_include_path = false;
|
var_dump(gzfile($filename, false));
|
||||||
|
var_dump(gzfile($filename, true));
|
||||||
|
|
||||||
$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 ) );
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
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)
|
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(sTrInG): 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
|
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|||||||
@@ -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
|
|
||||||
"
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,7 @@ Test function gzgetc() by calling it with its expected arguments zlib 1.2.5
|
|||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
|
include 'data/func.inc';
|
||||||
include 'func.inc';
|
|
||||||
if (version_compare(get_zlib_version(), '1.2.5') > 0) {
|
if (version_compare(get_zlib_version(), '1.2.5') > 0) {
|
||||||
die('skip - only for zlib <= 1.2.5');
|
die('skip - only for zlib <= 1.2.5');
|
||||||
}
|
}
|
||||||
@@ -16,7 +15,7 @@ if (version_compare(get_zlib_version(), '1.2.5') > 0) {
|
|||||||
// note that gzgets is an alias to fgets. parameter checking tests will be
|
// note that gzgets is an alias to fgets. parameter checking tests will be
|
||||||
// the same as gzgets
|
// the same as gzgets
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ zlib
|
|||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include 'func.inc';
|
include 'data/func.inc';
|
||||||
if (version_compare(get_zlib_version(), '1.2.7') < 0) {
|
if (version_compare(get_zlib_version(), '1.2.7') < 0) {
|
||||||
die('skip - only for zlib >= 1.2.7');
|
die('skip - only for zlib >= 1.2.7');
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ if (version_compare(get_zlib_version(), '1.2.7') < 0) {
|
|||||||
// note that gzgets is an alias to fgets. parameter checking tests will be
|
// note that gzgets is an alias to fgets. parameter checking tests will be
|
||||||
// the same as gzgets
|
// the same as gzgets
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
if ($h) {
|
if ($h) {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ zlib
|
|||||||
// note that gzgets is an alias to fgets. parameter checking tests will be
|
// note that gzgets is an alias to fgets. parameter checking tests will be
|
||||||
// the same as fgets
|
// the same as fgets
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
$lengths = array(10, 14, 7, 99);
|
$lengths = array(10, 14, 7, 99);
|
||||||
foreach ($lengths as $length) {
|
foreach ($lengths as $length) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test gzinflate() function : error conditions
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzinflate() : error conditions ***\n";
|
echo "*** Testing gzinflate() : error conditions ***\n";
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ $original = 'aaaaaaaaaaaaaaa';
|
|||||||
$packed=gzdeflate($original);
|
$packed=gzdeflate($original);
|
||||||
echo strlen($packed)." ".strlen($original)."\n";
|
echo strlen($packed)." ".strlen($original)."\n";
|
||||||
$unpacked=gzinflate($packed, strlen($original));
|
$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);
|
$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);
|
$unpacked=gzinflate($packed, 1);
|
||||||
if ($unpacked === false) echo "Failed (as expected)\n";
|
if ($unpacked === false) echo "Failed (as expected)\n";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ echo "*** Testing gzopen() : basic functionality ***\n";
|
|||||||
|
|
||||||
|
|
||||||
// Initialise all required variables
|
// Initialise all required variables
|
||||||
$filename = __DIR__."/004.txt.gz";
|
$filename = __DIR__."/data/test.txt.gz";
|
||||||
$mode = 'r';
|
$mode = 'r';
|
||||||
$use_include_path = false;
|
$use_include_path = false;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ zlib
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h1 = gzopen($f, 'r');
|
$h1 = gzopen($f, 'r');
|
||||||
$h2 = gzopen($f, 'r');
|
$h2 = gzopen($f, 'r');
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ echo "*** Testing gzopen() : variation ***\n";
|
|||||||
|
|
||||||
$modes = array('r+', 'rf', 'w+' , 'e');
|
$modes = array('r+', 'rf', 'w+' , 'e');
|
||||||
|
|
||||||
$file = __DIR__."/004.txt.gz";
|
$file = __DIR__."/data/test.txt.gz";
|
||||||
|
|
||||||
foreach ($modes as $mode) {
|
foreach ($modes as $mode) {
|
||||||
echo "mode=$mode\n";
|
echo "mode=$mode\n";
|
||||||
@@ -38,6 +38,6 @@ gzopen=bool(false)
|
|||||||
|
|
||||||
mode=e
|
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)
|
gzopen=bool(false)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ zlib
|
|||||||
// note that gzpassthru is an alias to fpassthru. parameter checking tests will be
|
// note that gzpassthru is an alias to fpassthru. parameter checking tests will be
|
||||||
// the same as fpassthru
|
// the same as fpassthru
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
var_dump(gzpassthru($h));
|
var_dump(gzpassthru($h));
|
||||||
var_dump(gzpassthru($h));
|
var_dump(gzpassthru($h));
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ zlib
|
|||||||
// note that gzread is an alias to fread. parameter checking tests will be
|
// note that gzread is an alias to fread. parameter checking tests will be
|
||||||
// the same as fread
|
// the same as fread
|
||||||
|
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
$lengths = array(10, 14, 7, 99, 2000);
|
$lengths = array(10, 14, 7, 99, 2000);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzread() by calling it invalid lengths
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
var_dump(gzread($h, 10));
|
var_dump(gzread($h, 10));
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzrewind() by calling it with its expected arguments when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
echo "test rewind before doing anything\n";
|
echo "test rewind before doing anything\n";
|
||||||
var_dump(gzrewind($h));
|
var_dump(gzrewind($h));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzrewind() by calling it with its expected arguments when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
|
|
||||||
// read to the end of the file
|
// read to the end of the file
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzseek() by calling it with its expected arguments when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
|
|
||||||
echo "move to the 50th byte\n";
|
echo "move to the 50th byte\n";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzseek() by calling it with SEEK_SET when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
|
|
||||||
echo "move to the 50th byte\n";
|
echo "move to the 50th byte\n";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzseek() by calling it with SEEK_CUR when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
|
|
||||||
echo "move to the 50th byte\n";
|
echo "move to the 50th byte\n";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gzseek() by calling it with SEEK_END when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
// move 40 bytes
|
// move 40 bytes
|
||||||
echo "move 40 bytes\n";
|
echo "move 40 bytes\n";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function gztell() by calling it with its expected arguments when reading
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, 'r');
|
$h = gzopen($f, 'r');
|
||||||
$intervals = array(7, 22, 54, 17, 27, 15, 1000);
|
$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)
|
// tell should be 7, 29, 83, 100, 127, 142, 176 (176 is length of uncompressed file)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test gzuncompress() function : basic functionality
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include(__DIR__ . '/data.inc');
|
include(__DIR__ . '/data/data.inc');
|
||||||
|
|
||||||
echo "*** Testing gzuncompress() : basic functionality ***\n";
|
echo "*** Testing gzuncompress() : basic functionality ***\n";
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ zlib
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$filename = __DIR__."/004.txt.gz";
|
$filename = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($filename, 'r');
|
$h = gzopen($filename, 'r');
|
||||||
$str = "Here is the string to be written. ";
|
$str = "Here is the string to be written. ";
|
||||||
$length = 10;
|
$length = 10;
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ zlib.output_compression
|
|||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
--CGI--
|
||||||
if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
|
|
||||||
?>
|
|
||||||
--GET--
|
--GET--
|
||||||
a=b
|
a=b
|
||||||
--INI--
|
--INI--
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ zlib.output_compression
|
|||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
--CGI--
|
||||||
if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
|
|
||||||
?>
|
|
||||||
--INI--
|
--INI--
|
||||||
zlib.output_compression=0
|
zlib.output_compression=0
|
||||||
--ENV--
|
--ENV--
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ ob_gzhandler
|
|||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
--CGI--
|
||||||
if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
|
|
||||||
?>
|
|
||||||
--INI--
|
--INI--
|
||||||
zlib.output_compression=0
|
zlib.output_compression=0
|
||||||
--ENV--
|
--ENV--
|
||||||
|
|||||||
@@ -2,10 +2,7 @@
|
|||||||
ob_gzhandler
|
ob_gzhandler
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--CGI-
|
||||||
<?php
|
|
||||||
if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
|
|
||||||
?>
|
|
||||||
--INI--
|
--INI--
|
||||||
zlib.output_compression=0
|
zlib.output_compression=0
|
||||||
--ENV--
|
--ENV--
|
||||||
|
|||||||
@@ -2,10 +2,7 @@
|
|||||||
ob_gzhandler legacy
|
ob_gzhandler legacy
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--CGI--
|
||||||
<?php
|
|
||||||
if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi");
|
|
||||||
?>
|
|
||||||
--INI--
|
--INI--
|
||||||
zlib.output_compression=0
|
zlib.output_compression=0
|
||||||
--ENV--
|
--ENV--
|
||||||
|
|||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -1,39 +1,17 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test function readgzfile() by substituting argument 1 with string values.
|
readgzfile() with unknown file
|
||||||
--EXTENSIONS--
|
--EXTENSIONS--
|
||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$file = "unknown_file.txt.gz";
|
||||||
$use_include_path = false;
|
var_dump(readgzfile($file, false));
|
||||||
|
var_dump(readgzfile($file, true));
|
||||||
|
|
||||||
$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 ) );
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
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)
|
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(sTrInG): 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
|
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|||||||
@@ -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)
|
|
||||||
@@ -10,7 +10,7 @@ if (PHP_OS_FAMILY !== "Windows") die("skip Only for Windows because it has manda
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo "without wrapper\n";
|
echo "without wrapper\n";
|
||||||
$f = __DIR__."/005.txt.gz";
|
$f = __DIR__."/data/windows-test.txt.gz";
|
||||||
$h = gzopen($f,'r');
|
$h = gzopen($f,'r');
|
||||||
$h2 = gzopen($f, 'r');
|
$h2 = gzopen($f, 'r');
|
||||||
stream_set_chunk_size($h2,1);
|
stream_set_chunk_size($h2,1);
|
||||||
@@ -23,9 +23,9 @@ gzclose($h);
|
|||||||
gzclose($h2);
|
gzclose($h2);
|
||||||
|
|
||||||
echo "\nwith wrapper\n";
|
echo "\nwith wrapper\n";
|
||||||
$f = "compress.zlib://".__DIR__."/005.txt.gz";
|
$f2 = "compress.zlib://".$f;
|
||||||
$h = fopen($f,'r');
|
$h = fopen($f2,'r');
|
||||||
$h2 = fopen($f, 'r');
|
$h2 = fopen($f2, 'r');
|
||||||
stream_set_chunk_size($h2, 1);
|
stream_set_chunk_size($h2, 1);
|
||||||
|
|
||||||
var_dump(flock($h, LOCK_EX));
|
var_dump(flock($h, LOCK_EX));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the copy function: compressed to compressed
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$outputFileName = __FILE__.'.tmp';
|
$outputFileName = __FILE__.'.tmp';
|
||||||
|
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the copy function: compressed to uncompressed
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$outputFileName = __FILE__.'.tmp';
|
$outputFileName = __FILE__.'.tmp';
|
||||||
|
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the file
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
$contents = file($srcFile);
|
$contents = file($srcFile);
|
||||||
var_dump($contents);
|
var_dump($contents);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the file_get_contents
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
$contents = file_get_contents($srcFile);
|
$contents = file_get_contents($srcFile);
|
||||||
echo $contents;
|
echo $contents;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the file_get_contents
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
readfile($srcFile);
|
readfile($srcFile);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the fopen
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
$h = fopen($srcFile, 'r');
|
$h = fopen($srcFile, 'r');
|
||||||
fpassthru($h);
|
fpassthru($h);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the fopen on a file scheme
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "file://$inputFileName";
|
$srcFile = "file://$inputFileName";
|
||||||
$compressedFile = "compress.zlib://$srcFile";
|
$compressedFile = "compress.zlib://$srcFile";
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ fpassthru($h);
|
|||||||
fclose($h);
|
fclose($h);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
file=compress.zlib://file://%s/004.txt.gz
|
file=compress.zlib://file://%s/test.txt.gz
|
||||||
|
|
||||||
When you're taught through feelings
|
When you're taught through feelings
|
||||||
Destiny flying high above
|
Destiny flying high above
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the unlink function
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
rename($srcFile, 'something.tmp');
|
rename($srcFile, 'something.tmp');
|
||||||
var_dump(file_exists($inputFileName));
|
var_dump(file_exists($inputFileName));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the unlink function
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
echo "file_exists=";
|
echo "file_exists=";
|
||||||
var_dump(file_exists($srcFile));
|
var_dump(file_exists($srcFile));
|
||||||
@@ -30,11 +30,11 @@ is_dir=bool(false)
|
|||||||
is_readable=bool(false)
|
is_readable=bool(false)
|
||||||
|
|
||||||
filesize=
|
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)
|
bool(false)
|
||||||
filetype=
|
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)
|
bool(false)
|
||||||
fileatime=
|
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)
|
bool(false)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test compress.zlib:// scheme with the unlink function
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$inputFileName = __DIR__."/004.txt.gz";
|
$inputFileName = __DIR__."/data/test.txt.gz";
|
||||||
$srcFile = "compress.zlib://$inputFileName";
|
$srcFile = "compress.zlib://$inputFileName";
|
||||||
unlink($srcFile);
|
unlink($srcFile);
|
||||||
var_dump(file_exists($inputFileName));
|
var_dump(file_exists($inputFileName));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function flock on a zlib stream
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f,'r');
|
$h = gzopen($f,'r');
|
||||||
var_dump(flock($h, LOCK_EX));
|
var_dump(flock($h, LOCK_EX));
|
||||||
gzclose($h);
|
gzclose($h);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function fstat() on zlib wrapper
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f, "r");
|
$h = gzopen($f, "r");
|
||||||
var_dump(fstat($h));
|
var_dump(fstat($h));
|
||||||
fclose($h);
|
fclose($h);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Test function ftruncate() on zlib wrapper by calling it with its expected argume
|
|||||||
zlib
|
zlib
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$f2 = "zlib_wrapper_ftruncate_basic.txt.gz";
|
$f2 = "zlib_wrapper_ftruncate_basic.txt.gz";
|
||||||
copy($f, $f2);
|
copy($f, $f2);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ compress.zlib:// wrapper with compression level
|
|||||||
zlib
|
zlib
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?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--
|
--FILE--
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ zlib
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
echo "no wrapper\n";
|
echo "no wrapper\n";
|
||||||
$f = __DIR__."/004.txt.gz";
|
$f = __DIR__."/data/test.txt.gz";
|
||||||
$h = gzopen($f,'r');
|
$h = gzopen($f,'r');
|
||||||
var_dump(stream_get_meta_data($h));
|
var_dump(stream_get_meta_data($h));
|
||||||
gzclose($h);
|
gzclose($h);
|
||||||
echo "\nwith wrapper\n";
|
echo "\nwith wrapper\n";
|
||||||
$f = "compress.zlib://".__DIR__."/004.txt.gz";
|
$f2 = "compress.zlib://" . $f;
|
||||||
$h = fopen($f,'r');
|
$h = fopen($f2,'r');
|
||||||
var_dump(stream_get_meta_data($h));
|
var_dump(stream_get_meta_data($h));
|
||||||
gzclose($h);
|
gzclose($h);
|
||||||
|
|
||||||
@@ -55,5 +55,5 @@ array(9) {
|
|||||||
["seekable"]=>
|
["seekable"]=>
|
||||||
bool(true)
|
bool(true)
|
||||||
["uri"]=>
|
["uri"]=>
|
||||||
string(%d) "compress.zlib://%s/004.txt.gz"
|
string(%d) "compress.zlib://%s/test.txt.gz"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user