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