#40437 [Asn->Fbk]: decompress.bzip2 is broken
| From: | jani@php.net | Date: | Sun, 02 Nov 2008 12:40:41 +0000 |
| Subject: | #40437 [Asn->Fbk]: decompress.bzip2 is broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130471@lists.php.net to get a copy of this message | ||
ID: 40437
Updated by: jani@php.net
Reported By: phpbugger dot 5 dot n1 at spamgourmet dot com
-Status: Assigned
+Status: Feedback
Bug Type: Bzip2 Related
Operating System: Linux
PHP Version: 5.2.1
Assigned To: tony2001
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
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