ID: 34821 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: Zlib Related -Operating System: * +Operating System: Win32 PHP Version: 5CVS-2005-10-10 (cvs) New Comment:
It apparently only fails on Windows... Don't ask me why I didn't check on Linux too, at the first place, but Tony, why did you request a patch? Did you try the script and did it fail or not? Previous Comments: ------------------------------------------------------------------------ [2005-10-13 19:05:23] [EMAIL PROTECTED] I've just tried the code on Linux using 5.1-cvs and I am not seeing any errors being reported. ------------------------------------------------------------------------ [2005-10-11 19:03:43] [EMAIL PROTECTED] http://dev.iworks.at/PATCHES/bug_34821.txt ------------------------------------------------------------------------ [2005-10-11 18:43:31] [EMAIL PROTECTED] Do you have a patch? ------------------------------------------------------------------------ [2005-10-11 17:38:00] [EMAIL PROTECTED] A possible fix would be to raise the size of the memory allocated by default, e.g. adding 1% to the length of the incoming data instead of 0.1% additionally to some "safe" padding bytes. ------------------------------------------------------------------------ [2005-10-10 22:50:22] [EMAIL PROTECTED] Description: ------------ Probably an edge case, but so nobody could claim I didn't report it ;) It starts to fail with ~200k+. Reproduce code: --------------- <?php $j = 200000; $s = ''; srand(time()); for ($i = 0; $i < $j; ++$i) { $s .= chr(rand(0,255)); } gzencode($s); // fails with buffer error $r = array(); echo "\nCharcode stats:\n"; for ($i = 0; $i < $j; ++$i) { $x = ord($s{$i}); $r[$x] = isset($r[$x]) ? $r[$x]+1 : 1; } asort($r); printf("MIN: %d -- AVG: %d -- MAX: %d\n", current($r), array_sum($r)/count($r), end($r)); ?> Expected result: ---------------- No error Actual result: -------------- Warning: gzencode(): buffer error in C:\Webserver\mike\zone\gzencode.php on line 10 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34821&edit=1