PHP 4.0 Bug #6481 Updated: Gzcompress
| From: | Bug Database | Date: | Wed, 11 Oct 2000 13:36:54 +0000 |
| Subject: | PHP 4.0 Bug #6481 Updated: Gzcompress | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34669@lists.php.net to get a copy of this message | ||
ID: 6481
Updated by: stas
Reported By: wico@cnh.nl
Status: Analyzed
Bug Type: Documentation problem
Assigned To:
Comments:
See also #7033
Previous Comments:
---------------------------------------------------------------------------
[2000-09-26 23:56:52] wico@cnh.nl
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@boas.anthro.mnsu.edu
---------------------------------------------------------------------------
[2000-09-23 22:21:29] stas@php.net
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@cnh.nl
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@cnh.nl
Subject: gzcompress() broken
To: wico@cnh.nl
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@boas.anthro.mnsu.edu
---------------------------------------------------------------------------
[2000-09-04 03:33:49] wico@cnh.nl
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);
}
---------------------------------------------------------------------------
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