[PHP-DEV] PHP 4.0 Bug #6481 Updated: Gzcompress From: Bug Database (php-dev <email protected>)
Date: 09/26/00

ID: 6481
User Update by: wico <email protected>
Old-Status: Closed
Status: Open
Bug Type: *Zlib related
Description: Gzcompress

I realy think this should be in the manual (where you can find it easly), but also should have a fix/workaround
(i opened it again because i realy think this should be fixed, and that stuff about the crc doesn't look verry right to me either)

Greetz, tnx,

Wico

this did i got from Tyler Akins (thx for your effort and support)

Remember when I told you why gzcompress() doesn't work as it should if you
want to output compressed data?

[ I wrote ]
> I was checking out http://bugs.php.net/bugs.php?id=6481 and found out
> why you are right. :-)

Anyway, I wrote a lengthy note on the PHP page explaining how to get it to
work properly for outputting compressed data to the client. You might want to
check it out.

    http://www.php.net/manual/function.gzcompress.php

Basically, it doesn't output the gzip header, it doesn't output a proper CRC,
and it certainly doesn't add the size field. For more information on
gzip-style files, check out

    http://swrinde.nde.swri.edu.pub/png/documents/zlib/rfc-gzip.html

Hope this helps. Actually this information would probably be really nice to
put in the bug report.

-- 
Tyler Akins                    tyler <email protected>

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

[2000-09-23 22:21:29] stas <email protected> I guess you should use gzopen("php://stdout","w") instead, because gzcompress doesn't have all gzip file headers too. In other words, gzcompress and gzopen/gzwrite are different functions, and in zlib too.

---------------------------------------------------------------------------

[2000-09-20 16:11:52] wico <email protected> Move to the rigth bug section

P.S. can someone please take a look a this bug, my programm depends on it

Greetz,

Wico

---------------------------------------------------------------------------

[2000-09-20 16:08:40] wico <email protected> Subject: gzcompress() broken To: wico <email protected>

I was checking out http://bugs.php.net/bugs.php?id=6481 and found out why you are right. :-)

The rest of the functions in the zlib section all use gzip compression. gzcompress() and gzuncompress() do not -- they use a deflate style compression, if I remember right. To fix it, you need to edit the zlib files in PHP to call the correct zlib function.

It would be nice if you added this information for me (I have no desire to make a PHP bug reporting account) and if you moved it to the zlib section instead of a general question.

-- Tyler Akins tyler <email protected>

---------------------------------------------------------------------------

[2000-09-04 03:33:49] wico <email protected> Hiya

As i allready said in my email thats a typo.

This works:

function Compress ($data) { $fp = fopen("/tmp/tempje", "w"); fputs($fp, $data); fclose($fp); $data2 = `cat /tmp/tempje |/usr/bin/gzip -f`; Header("Content-Type: text/html"); Header("Content-Encoding: gzip"); echo($data2); }

this doesn't:

function Compress ($data) { $data = gzcompress($data); Header("Content-Type: text/html"); Header("Content-Encoding: gzip"); echo($data); }

---------------------------------------------------------------------------

[2000-09-03 06:02:23] stas <email protected> That's easy - you don't define data2 in second function.

---------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online.

Full Bug description available at: http://bugs.php.net/?id=6481

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>