File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / zlib / tests / bug_34821.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:05 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #34821 (zlib encoders fail on widely varying binary data)
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php

// test 50 bytes to 50k
$b = array(
	50, 
	500, 
	5000, 
	50000,
//	1000000, // works, but test would take too long
);

$s = '';
$i = 0;

foreach ($b as $size) {
	do {
		$s .= chr(rand(0,255));
	} while (++$i < $size);
	var_dump($s === gzinflate(gzdeflate($s)));
	var_dump($s === gzuncompress(gzcompress($s)));
	var_dump($s === gzinflate(substr(gzencode($s), 10, -8)));
}
?>
--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)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>