# compressed streams

- Thread: https://externals.io/message/11898
- Original archive: https://news-web.php.net/php.internals/11898
- Started by Nuno Lopes on 2004-08-04T11:04:31+00:00
- Messages: 9
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #11898 — Nuno Lopes — 2004-08-04T11:04:31+00:00

URL: https://externals.io/message/11898#11898

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

---

## #11899 — Derick Rethans — 2004-08-04T11:08:04+00:00

URL: https://externals.io/message/11898#11899 · In reply to: #11898

> 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

---

## #11900 — Nuno Lopes — 2004-08-04T11:16:44+00:00

URL: https://externals.io/message/11898#11900 · In reply to: #11899

> 
>
> > […]
conversion!
> > […]
>
> File a bug for this?
>
> regards,
> Derick


I just wanted to be sure I wasn't making any newbie mistake :)

Nuno

---

## #11901 — Wez Furlong — 2004-08-04T11:39:20+00:00

URL: https://externals.io/message/11898#11901 · In reply to: #11898

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.


> 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

---

## #11902 — Nuno Lopes — 2004-08-04T11:46:47+00:00

URL: https://externals.io/message/11898#11902 · In reply to: #11901

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 ----- 
> 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.

---

## #11903 — Wez Furlong — 2004-08-04T11:54:29+00:00

URL: https://externals.io/message/11898#11903 · In reply to: #11902

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.


> 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 -----
> > […]

---

## #11904 — Derick Rethans — 2004-08-04T11:55:46+00:00

URL: https://externals.io/message/11898#11904 · In reply to: #11902

> 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

---

## #11905 — Nuno Lopes — 2004-08-04T12:00:33+00:00

URL: https://externals.io/message/11898#11905 · In reply to: #11904

> > […]
> 
> 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

---

## #11906 — Nuno Lopes — 2004-08-04T12:36:15+00:00

URL: https://externals.io/message/11898#11906 · In reply to: #11903

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.
>
> 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.
