ID: 40188 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Assigned Bug Type: Streams related Operating System: kubuntu linux PHP Version: 5.2.0 -Assigned To: +Assigned To: pollita New Comment:
Sara, could you look into this? Previous Comments: ------------------------------------------------------------------------ [2007-01-21 22:07:56] [EMAIL PROTECTED] Description: ------------ This was detected in the phar extension, but can be reproduced with regular php code. Because _php_stream_read in main/streams/streams.c automatically truncates output from a streams filter to the maximum requested amount, this does not allow the possibility of specifying pre-filter amount of bytes to read. "new b" is 5 bytes, but zlib deflates it to a 7-byte length. Because writepos is > toread, it is cut to 5 bytes. A new flag is needed to specify that we want to read a maximum bytes, not write a maximum bytes. Although I put "int(7)" in the expected output, I don't expect this output unless a flag is passed that specifically asks to do this. Reproduce code: --------------- <?php file_put_contents('test1.txt', 'new b/next thing'); $a = fopen('test1.txt', 'rb'); $newa = fopen('test2.txt', 'wb'); stream_filter_append($a, 'zlib.deflate'); $b = stream_copy_to_stream($a, $newa, 5); var_dump($b, ftell($newa)); Expected result: ---------------- int(5) int(7) Actual result: -------------- int(5) int(5) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40188&edit=1