Annotation of embedaddon/php/ext/zlib/tests/bug_34821.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #34821 (zlib encoders fail on widely varying binary data)
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("zlib")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: // test 50 bytes to 50k
! 9: $b = array(
! 10: 50,
! 11: 500,
! 12: 5000,
! 13: 50000,
! 14: // 1000000, // works, but test would take too long
! 15: );
! 16:
! 17: $s = '';
! 18: $i = 0;
! 19:
! 20: foreach ($b as $size) {
! 21: do {
! 22: $s .= chr(rand(0,255));
! 23: } while (++$i < $size);
! 24: var_dump($s === gzinflate(gzdeflate($s)));
! 25: var_dump($s === gzuncompress(gzcompress($s)));
! 26: var_dump($s === gzinflate(substr(gzencode($s), 10, -8)));
! 27: }
! 28: ?>
! 29: --EXPECT--
! 30: bool(true)
! 31: bool(true)
! 32: bool(true)
! 33: bool(true)
! 34: bool(true)
! 35: bool(true)
! 36: bool(true)
! 37: bool(true)
! 38: bool(true)
! 39: bool(true)
! 40: bool(true)
! 41: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>