Php Gzuncompress Function.gzuncompress Data Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this warning gzuncompress() function.gzuncompress data error in site About Us Learn more about Stack Overflow the company Business Learn more gzdecode(): data error about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x gzuncompress online Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why PHP's
Php Decompress Gzip
gzuncompress() function can go wrong? up vote 2 down vote favorite PHP has its own function to work with gzip archives. I wrote the following code: error_reporting(E_ALL); $f = file_get_contents('http://spiderbites.nytimes.com/sitemaps/www.nytimes.com/sitemap.xml.gz'); echo $f; $f = gzuncompress($f); echo "
"; echo $f; First echo normally outputs the compressed file with proper header (at least first two bytes are correct). If I'd download this file with my browser call to undefined function gzuncompress() I can unzip it easily. However gzuncompress thrown Warning: gzuncompress(): data error in /home/path/to/script.php on line 5 Can anyone point me to the right direction to solve this problem? EDIT: The part of phpinfo() output php gzip unzip share|improve this question edited Dec 29 '14 at 16:55 asked Dec 29 '14 at 16:32 Vlada Katlinskaya 382212 You could use ob_gzhandler() to let PHP do the work for you using because the function gzuncompress() will return an error if the uncompressed data is more than 32768 times the length of the compressed input data or more than the optional parameter length. Or you can use the optional parameter to define the length. That should be an easy fix. –unixmiah Dec 29 '14 at 16:37 @unixmiah in my case size of the file is 4169 (compressed) / 88406 (uncompressed) so the ratio is far from 32768 (real ratio is about 21). –Vlada Katlinskaya Dec 29 '14 at 16:43 have you edited the php.ini and enabled the zip libraries? if you haven't do so and restart your web server after doing that to take the changes yo
were looking for could not https://wordpress.org/support/topic/342988 be found. I'm sorry, it's not your fault… probably. About Blog Hosting Jobs Support Developers Get Involved Learn Showcase Plugins Themes Ideas WordCamp WordPress.TV BuddyPress bbPress WordPress.com Matt Privacy License / GPLv2 Code is Poetry.
pm From: atz at atz dot msk dot http://grokbase.com/t/php/php-bugs/033y27qn9p/22967-new-gzuncompress-data-error-while-trying-to-uncompress-true-gzip-data ruOperating system: FreeBSD 5.0-RELEASEPHP version: 4CVS-2003-03-30 (stable)PHP Bug Type: Zlib RelatedBug description: "gzuncompress data error" while trying to uncompress TRUE gzip dataI'am trying https://www.braininjurymn.org/donate/assets/php/_core/image_label.php to fetch data with fsockopen and etc.from URLhttp://suncity.combats.ru/inf.pl?login=atzORhttp://capitalcity.combats.ru/inf.pl?login=atzAnd as result in variable named $Data i have a compressedgzip data from that url data error with "Content-encoding: gzip".But! When i try togzuncompress($Data)the php returnsWarning: gzuncompress(): data errorgzinflate($Data)Warning: gzinflate(): data errorI'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 datain varaiable named $buffer.Why gzuncompress do not function.gzuncompress data error uncompress $Data whilegzopen do this success?Is this a bug?--Edit bug report at http://bugs.php.net/?id=22967&edit=1--Try a CVS snapshot: http://bugs.php.net/fix.php?id=22967&r=trysnapshotFixed in CVS: http://bugs.php.net/fix.php?id=22967&r=fixedcvsFixed in release: http://bugs.php.net/fix.php?id=22967&r=alreadyfixedNeed backtrace: http://bugs.php.net/fix.php?id=22967&r=needtraceTry newer version: http://bugs.php.net/fix.php?id=22967&r=oldversionNot developer issue: http://bugs.php.net/fix.php?id=22967&r=supportExpected behavior: http://bugs.php.net/fix.php?id=22967&r=notwrongNot enough info: http://bugs.php.net/fix.php?id=22967&r=notenoughinfoSubmitted twice: http://bugs.php.net/fix.php?id=22967&r=submittedtwiceregister_globals: http://bugs.php.net/fix.php?id=22967&r=globalsPHP 3 support discontinued: http://bugs.php.net/fix.php?id=22967&r=php3Daylight Savings: http://bugs.php.net/fix.php?id=22967&r=dstIIS Stability: http://bugs.php.net/fix.php?id=22967&r=isapiInstall GNU Sed: http://bugs.php.net/fix.php?id=22967&r=gnused reply Tweet Search Discussions Search All Groups PHP php-bugs 2 responses Oldest Nested Wez 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 gzuncompres
5.0) Gecko/20101221 Firefox/3.8.0 (.NET CLR 2.5.30) gzuncompress()[