php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22967 "gzuncompress data error" while trying to uncompress TRUE gzip data
Submitted: 2003-03-30 14:57 UTC Modified: 2005-06-29 12:41 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: atz at atz dot msk dot ru Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4CVS-2003-03-30 (stable) OS: FreeBSD 5.0-RELEASE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: atz at atz dot msk dot ru
New email:
PHP Version: OS:

 

 [2003-03-30 14:57 UTC] 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?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-31 06:28 UTC] wez@php.net
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.
 [2005-06-29 12:41 UTC] nlopess@php.net
Duplicate of #22123.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun May 22 20:05:44 2022 UTC