From: Keisial at gmail dot com Operating system: PHP version: 5.2CVS-2008-09-08 (snap) PHP Bug Type: Filter related Bug description: bz2_decompress_filter tries to decompress after end of stream
Description: ------------ If the input is larger than the bzip2 stream, bz2_decompress_filter tries to continue decompressing after it has received a BZ_STREAM_END, so bzlib returns BZ_SEQUENCE_ERROR and the stream filter finalises with PSFS_ERR_FATAL, getting no output. Reproduce code: --------------- bz2Decompress.php: <?php $f = fopen($argv[1], "rb"); stream_filter_append($f, "bzip2.decompress"); fpassthru($f); fclose($f); ?> $ echo 'Hello world' > hello.txt $ bzip2 hello.txt $ php bz2Decompress.php hello.txt.bz2 Hello world $ echo '!' >> hello.txt.bz2 $ php bz2Decompress.php hello.txt.bz2 /* No output */ Expected result: ---------------- At least the correctly read data should be returned. Two things can be done on receiving a BZ_STREAM_END: -Setting an EOF flag and remove any further incoming data (allow to continue reading if the filter is removed?). -Reinitialising the decompressing library (approach of the bzip2 utility) so concatenated bzip2 streams can be unbzipped as the concatenation of its output. -- Edit bug report at http://bugs.php.net/?id=46026&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46026&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46026&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46026&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46026&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46026&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46026&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46026&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46026&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46026&r=support Expected behavior: http://bugs.php.net/fix.php?id=46026&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46026&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46026&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46026&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46026&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46026&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46026&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46026&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46026&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46026&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46026&r=mysqlcfg