|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-12 05:38 UTC] alberty at neptunlabs dot de
Hi,
the follow code produces a deflated string
which php can not inflate.
php results:
"Warning: gzinflate: buffer error in /web/htdocs/thisfile.php"
----
<tt>
<?php
error_reporting(63);
mt_srand ((double) microtime() * 1000000);
for ($original="",$i=0;$i<5000;$i++){
//$original.=chr(mt_rand()); //
$original.="lala "; // problem
}
$packed=gzdeflate($original); // gzcompress
$unpacked=gzinflate($packed); // gzuncompress
echo "Length original:".strlen($original)."<br>";
echo "Length packed:".strlen($packed)."<br>";
echo "Length unpacked:".strlen($unpacked)."<br>";
if (strcmp($original,$unpacked)==0) echo "Strings are equal";
else echo "<b>Strings <u>not</u> equal</b>";
?>
</tt>
----
Regards,
--
Steve
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 03:00:01 2025 UTC |
Hi Thies, thank you for your changes in zlib.c but you have not really fix the problem. If i increase the string repeating from 5000 to 35000, i have the same problem again, but i don't no why, sometimes php works correct... <---snip---> <tt> <?php error_reporting(63); mt_srand ((double) microtime() * 1000000); for ($original="",$i=0;$i<35000;$i++){ //$out.=chr(mt_rand()); // $original.="lala "; // problem } $packed=gzdeflate($original); // gzcompress $unpacked=gzinflate($packed); // gzuncompress echo "Length original:".strlen($original)."<br>"; echo "Length packed:".strlen($packed)."<br>"; echo "Length unpacked:".strlen($unpacked)."<br>"; if (strcmp($original,$unpacked)==0) echo "Strings are equal"; else echo "<b>Strings <u>not</u> equal</b>"; ?> </tt> <---snap---> Regards, -- Steve