ID:               40437
 Comment by:       mark at mlstuff dot co dot uk
 Reported By:      phpbugger dot 5 dot n1 at spamgourmet dot com
 Status:           Open
 Bug Type:         Bzip2 Related
 Operating System: Linux
 PHP Version:      5.2.1
 New Comment:

Using the read/write parameter STREAM_FILTER_READ seems to fix this.

stream_filter_append($fp, 'bzip2.decompress', STREAM_FILTER_READ);


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to