2005-10-25 15:16:20 +00:00
|
|
|
--TEST--
|
2006-12-05 23:03:19 +00:00
|
|
|
Bug #34821 (zlib encoders fail on widely varying binary data)
|
2005-10-25 15:16:20 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php if (!extension_loaded("zlib")) print "skip"; ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
2007-01-03 22:32:49 +00:00
|
|
|
// test 50 bytes to 50k
|
2005-10-25 15:16:20 +00:00
|
|
|
$b = array(
|
|
|
|
50,
|
|
|
|
500,
|
|
|
|
5000,
|
2007-01-03 22:32:49 +00:00
|
|
|
50000,
|
2005-10-25 15:16:20 +00:00
|
|
|
// 1000000, // works, but test would take too long
|
|
|
|
);
|
|
|
|
|
2006-12-28 19:52:37 +00:00
|
|
|
$s = '';
|
|
|
|
$i = 0;
|
2005-10-25 15:16:20 +00:00
|
|
|
|
|
|
|
foreach ($b as $size) {
|
2006-12-28 19:52:37 +00:00
|
|
|
do {
|
2005-10-25 15:16:20 +00:00
|
|
|
$s .= chr(rand(0,255));
|
2006-12-28 19:52:37 +00:00
|
|
|
} while (++$i < $size);
|
|
|
|
var_dump($s === gzinflate(gzdeflate($s)));
|
|
|
|
var_dump($s === gzuncompress(gzcompress($s)));
|
|
|
|
var_dump($s === gzinflate(substr(gzencode($s), 10, -8)));
|
2005-10-25 15:16:20 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|