#22967 [Opn]: "gzuncompress data error" while trying to uncompress TRUE gzip data
| From: | wez@php.net | Date: | Mon, 31 Mar 2003 12:28:55 +0000 |
| Subject: | #22967 [Opn]: "gzuncompress data error" while trying to uncompress TRUE gzip data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-36804@lists.php.net to get a copy of this message | ||
ID: 22967
Updated by: wez@php.net
Reported By: atz at atz dot msk dot ru
Status: Open
-Bug Type: Zlib Related
+Bug Type: Feature/Change Request
Operating System: FreeBSD 5.0-RELEASE
PHP Version: 4CVS-2003-03-30 (stable)
New Comment:
the gzuncompress() function expects to decompress the header-less data
generated by gzcompress().
The workaround is to write to a temp file and read it in, or you could
just cut-off the gzip header and try gzuncompress. (the header is
usually 10 bytes in length, so gzuncompress(substr($Data,10)) might
work).
It looks like you need the opposite of gzencode(), which can will
correctly deal with this.
Previous Comments:
------------------------------------------------------------------------
[2003-03-30 14:57:44] atz at atz dot msk dot ru
I'am trying to fetch data with fsockopen and etc.
from URL
http://suncity.combats.ru/inf.pl?login=atz
OR
http://capitalcity.combats.ru/inf.pl?login=atz
And as result in variable named $Data i have a compressed
gzip data from that url with "Content-encoding: gzip".
But! When i try to
gzuncompress($Data)
the php returns
Warning: gzuncompress(): data error
gzinflate($Data)
Warning: gzinflate(): data error
I'm try to do following:
$fp = fopen("gzipped","w");
fwrite($fp, $Data, strlen($Data));
fclose($fp);
$buffer = "";
$gzfp = gzopen("gzipped","r");
while (!gzeof($gzfp)) {
$buffer .= gzread($gzfp, 1024);
}
gzclose($gzfp);
And as result i have normal UNCOMPRESSED data
in varaiable named $buffer.
Why gzuncompress do not uncompress $Data while
gzopen do this success?
Is this a bug?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22967&edit=1