go to bug id or search bugs for
appending a stream filter to a stream that has already had data read into its buffer can cause unfiltered data to be read back in. This is because the data is written to writepos, but read from readpos, and so the buffer should be invalidated (writepos/readpos set to 0) prior to writing back the filtered data.
This bug affects all PHP versions, and will be fixed in 5.2, 5.3, and 6.0 by me, I have a working patch ready to commit momentarily
This bug was causing ext/phar/tests/zip/badalias.phpt to fail
execute within php5/ext/phar/tests/zip:
$a = fopen(dirname(__FILE__) . '/files/' . "badalias1.phar.zip", 'rb');
fseek($a, 37); // seek to zip header
$b = fread($a, 30);
fseek($a, 82); // seek to file data
stream_filter_append($a, 'zlib.inflate', STREAM_FILTER_READ);
Add a Patch
Add a Pull Request
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.