compressed streams

php.internals

Nuno Lopes

22 years ago
Hello, I know this isn't as exciting as the GOTO discussion, but I need some help. I don't know if this just my fault, or if it's a PHP problem. Consider this: <? $fp=fopen('compress.bzip2://http://php.net/backend/notes/all.bz2', 'r'); while (!feof($fp)) { echo fgets($fp, 4096); } fclose($fp); ?> This gives an error: Warning: fopen() 1137 bytes of buffered data lost during stream conversion! in /cvs/livedocs/test_bz.php on line 3 And outputs nothing more. I'm using PHP 5.1. Whats is wrong here? Thanks for your time, Nuno

Derick Rethans

22 years ago
On Wed, 4 Aug 2004, Nuno Lopes wrote:
> This gives an error: > Warning: fopen() 1137 bytes of buffered data lost during stream conversion! > in /cvs/livedocs/test_bz.php on line 3 > > And outputs nothing more. I'm using PHP 5.1. > > Whats is wrong here?
File a bug for this? regards, Derick

Nuno Lopes

22 years ago
> On Wed, 4 Aug 2004, Nuno Lopes wrote: > > > This gives an error: > > Warning: fopen() 1137 bytes of buffered data lost during stream
conversion!
> > in /cvs/livedocs/test_bz.php on line 3 > > > > And outputs nothing more. I'm using PHP 5.1. > > > > Whats is wrong here? > > File a bug for this? > > regards, > Derick
I just wanted to be sure I wasn't making any newbie mistake :) Nuno

Wez Furlong

22 years ago
Most likely a bug in the bzip2 wrapper. It might not be fixable, and it might be better to use Sara's bzip2 filter from pecl instead. --Wez. On Wed, 4 Aug 2004 12:04:31 +0100, Nuno Lopes <nlopess@php.net> wrote:

Nuno Lopes

22 years ago
This code is in PHP 5.1. We have plents of time to fix it. If the PECL code works, why not copy it? I need this to allow anyone to compile livedocs with notes (without needing the token) Nuno ----- Original Message -----

Wez Furlong

22 years ago
A filter != wrapper, so copying the code won't work. Filters are preferred over wrappers for compression/decompression in any case. I didn't say we weren't going to fix the bug, just that it might not be fixable; need to check into it. You don't *need* it, since you can always do this: $name = tempnam('/tmp', 'notes'); copy("http://.....", $name); fopen("compress.bzip://$name", 'r'); --Wez. On Wed, 4 Aug 2004 12:46:47 +0100, Nuno Lopes <nlopess@php.net> wrote:

Nuno Lopes

22 years ago
Great idea, Wez! It is working now. Nuno ----- Original Message -----
> A filter != wrapper, so copying the code won't work. > Filters are preferred over wrappers for compression/decompression in any
case.

Derick Rethans

22 years ago
On Wed, 4 Aug 2004, Nuno Lopes wrote:
> This code is in PHP 5.1. We have plents of time to fix it. > If the PECL code works, why not copy it? I need this to allow anyone to > compile livedocs with notes (without needing the token)
The point of the token is that people can not get the notes easily. So I wonder how you're handling this now... Derick

Nuno Lopes

22 years ago
> > This code is in PHP 5.1. We have plents of time to fix it. > > If the PECL code works, why not copy it? I need this to allow anyone to > > compile livedocs with notes (without needing the token) > > The point of the token is that people can not get the notes easily. So I > wonder how you're handling this now... > > Derick
They are in all mirrors at: http://php.net/backend/notes/all.bz2