ID: 40437 Updated by: [EMAIL PROTECTED] Reported By: phpbugger dot 5 dot n1 at spamgourmet dot com -Status: Open +Status: Assigned Bug Type: Bzip2 Related Operating System: Linux PHP Version: 5.2.1 -Assigned To: +Assigned To: tony2001
Previous Comments: ------------------------------------------------------------------------ [2007-02-11 21:36:04] mark at mlstuff dot co dot uk Using the read/write parameter STREAM_FILTER_READ seems to fix this. stream_filter_append($fp, 'bzip2.decompress', STREAM_FILTER_READ); ------------------------------------------------------------------------ [2007-02-11 21:05:13] phpbugger dot 5 dot n1 at spamgourmet dot com Description: ------------ (See example code) - when using the bzip2.decompress filter on a http://-stream, php uses a lot of CPU resources and hangs. Decompressing with bzdecompress works, however, as does using zlib.decompress filters on .gz files via HTTP. Reproduce code: --------------- <?php $url = 'http://php.net/backend/notes/all.bz2'; $url = 'http://de.archive.ubuntu.com/ubuntu/dists/edgy/restricted/binary-i386/Packages.bz2'; /* this works: */ $data = bzdecompress(file_get_contents($url)); echo "bzdecompress is finished!\n"; /* however, file_get_contents will block while PHP uses a lot of CPU time */ $fp = fopen($url,'rb'); stream_filter_append($fp, 'bzip2.decompress'); stream_get_contents($fp); echo "stream_get_contents is finished!\n" ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40437&edit=1