php-src/ext/zlib/tests/001.phpt
Stefan Roehrich cede952f6a (PHP gzinflate) Workaround for bug #14939 (buffer error in gzinflate()).
Fixed prototype and added test for #14939.

# We have extra \0 if the input comes directly from gzdeflate()
# so give one extra byte as length to workaround behaviour of zlib.
# I want to avoid copying the input, but if there are problems,
# please tell (see my message <20020310175611.GA4472@stefan.roehri.ch> to
# php-dev).
2002-03-12 13:06:40 +00:00

26 lines
621 B
PHP

--TEST--
gzdeflate()/gzinflate()
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
$original = str_repeat("hallo php",4096);
$packed=gzdeflate($original);
echo strlen($packed)." ".strlen($original)."\n";
$unpacked=gzinflate($packed);
if (strcmp($original,$unpacked)==0) echo "Strings are equal";
echo "\n";
$original = 'aaaaaaaaaaaaaaa';
$packed=gzdeflate($original);
echo strlen($packed)." ".strlen($original)."\n";
$unpacked=gzinflate($packed);
if (strcmp($original,$unpacked)==0) echo "Strings are equal";
?>
--EXPECT--
100 36864
Strings are equal
5 15
Strings are equal