From:             [EMAIL PROTECTED]
Operating system: *
PHP version:      5CVS-2005-10-10 (CVS)
PHP Bug Type:     Zlib Related
Bug description:  zlib encoders fail on widely varying binary data

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 bug report at http://bugs.php.net/?id=34821&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34821&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34821&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34821&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34821&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34821&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34821&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34821&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34821&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34821&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34821&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34821&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34821&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34821&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34821&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34821&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34821&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34821&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34821&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34821&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34821&r=mysqlcfg

Reply via email to