WP_Http_Encoding::decompress( string $compressed, int $length = null )

Decompression of deflated string.


Description

Will attempt to decompress using the RFC 1950 standard, and if that fails then the RFC 1951 standard deflate will be attempted. Finally, the RFC 1952 standard gzip decode will be attempted. If all fail, then the original compressed string will be returned.


Parameters

$compressed

(string) (Required) String to decompress.

$length

(int) (Optional) The optional length of the compressed data.

Default value: null


Return

(string|bool) False on failure.


Source

File: wp-includes/class-wp-http-encoding.php

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

		if ( empty($compressed) )
			return $compressed;

		if ( false !== ( $decompressed = @gzinflate( $compressed ) ) )
			return $decompressed;

		if ( false !== ( $decompressed = self::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;
	}


Changelog

Changelog
Version Description
WP-2.8.0 Introduced.