Jan 17, 2010
My Digital Life Editorial Team

Workaround to Fix PHP Warning gzuncompress() or gzinflate() Data Error in WordPress http.php

In WordPress 2.8 and 2.9 or its minor versions, WordPress http.php PHP script will cause and generate the following error message on the blog:

PHP Warning: gzuncompress() [function.gzuncompress]: data error in /home/domain/public_html/wp-includes/http.php on line 1824

Warning: gzinflate() [function.gzinflate]: data error in /home/domain/public_html/wp-includes/http.php on line 1855


The regression error can be logged on the Apache HTTPD server’s error log, or been displayed on the blog web pages if output to webpage is not turned off, leaving the error message spidered, crawled and indexed by search engines.

The error is caused raw-inflated content been returned to algorithm which does not compatible. The error is not serious, and can be ignored. WordPress developers have implemented the fix for the error in WordPress version 2.9.2 and future versions.

For bloggers who can’t wait to fix and resolve the error, just edit the http.php file, and change the following two functions to the following code:

function decompress( $compressed, $length = null ) {

if ( false !== ($decompressed = @gzinflate( $compressed ) ) )
	return $decompressed;
if ( false !== ( $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ) ) )
	return $decompressed;
if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) )
	return $decompressed;
if ( function_exists('gzdecode') ) {
	$decompressed = @gzdecode( $compressed );
	if ( false !== $decompressed )
		return $decompressed;
}
return $compressed;
}
function compatible_gzinflate($gzData) {

if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
	$i = 10;
	$flg = ord( substr($gzData, 3, 1) );
	if ( $flg > 0 ) {
		if ( $flg & 4 ) {
			list($xlen) = unpack('v', substr($gzData, $i, 2) );
			$i = $i + 2 + $xlen;
		}
		if ( $flg & 8 )
			$i = strpos($gzData, "\0", $i) + 1;
		if ( $flg & 16 )
			$i = strpos($gzData, "\0", $i) + 1;
		if ( $flg & 2 )
			$i = $i + 2;
	}
	return @gzinflate( substr($gzData, $i, -8) );
} else {
	return false;
}
}

Related posts:

  1. WordPress Call To Undefined Function get_currentuserinfo() PHP Error
  2. How to Customize, Modify or Change WordPress Database Connection Error Page
  3. Fix Fatal Error Call to Function get_link() on Non-Object in WordPress 2.8 Dashboard with Technorati Incoming Links RSS
  4. WordPress MySQL SQL Query Error in WPDB Class
  5. gmmktime Error in WordPress and MagpieRSS

3 Comments

  • Thanks for this update. I was just installing a new blog using WordPress 2.9.1 and this was driving me nuts.

  • Many Many thanks for helping

  • Thx for your Help – many many Thx !!!

Leave a comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Subscribe

Free email subscriptions
Get latest updates in email for free:

Translate This Page