WordPress at Your Fingertips
function is not described

Requests::decompress() public WP 1.0

Decompress an encoded body

Implements gzip, compress and deflate. Guesses which it is by attempting to decode.

{} It's a method of the class: Requests{}

No Hooks.

Return

String. Decompressed string

Usage

$result = Requests::decompress( $data );
$data(string) (required)
Compressed data in one of the above formats

Code of Requests::decompress() WP 5.8.3

public static function decompress($data) {
	if (substr($data, 0, 2) !== "\x1f\x8b" && substr($data, 0, 2) !== "\x78\x9c") {
		// Not actually compressed. Probably cURL ruining this for us.
		return $data;
	}

	if (function_exists('gzdecode')) {
		// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.gzdecodeFound -- Wrapped in function_exists() for PHP 5.2.
		$decoded = @gzdecode($data);
		if ($decoded !== false) {
			return $decoded;
		}
	}

	if (function_exists('gzinflate')) {
		$decoded = @gzinflate($data);
		if ($decoded !== false) {
			return $decoded;
		}
	}

	$decoded = self::compatible_gzinflate($data);
	if ($decoded !== false) {
		return $decoded;
	}

	if (function_exists('gzuncompress')) {
		$decoded = @gzuncompress($data);
		if ($decoded !== false) {
			return $decoded;
		}
	}

	return $data;
}