equal
deleted
inserted
replaced
12 * |
12 * |
13 * Includes RFC 1950, RFC 1951, and RFC 1952. |
13 * Includes RFC 1950, RFC 1951, and RFC 1952. |
14 * |
14 * |
15 * @since 2.8.0 |
15 * @since 2.8.0 |
16 */ |
16 */ |
|
17 #[AllowDynamicProperties] |
17 class WP_Http_Encoding { |
18 class WP_Http_Encoding { |
18 |
19 |
19 /** |
20 /** |
20 * Compress raw string using the deflate format. |
21 * Compress raw string using the deflate format. |
21 * |
22 * |
101 * @return string|false Decompressed string on success, false on failure. |
102 * @return string|false Decompressed string on success, false on failure. |
102 */ |
103 */ |
103 public static function compatible_gzinflate( $gz_data ) { |
104 public static function compatible_gzinflate( $gz_data ) { |
104 |
105 |
105 // Compressed data might contain a full header, if so strip it for gzinflate(). |
106 // Compressed data might contain a full header, if so strip it for gzinflate(). |
106 if ( "\x1f\x8b\x08" === substr( $gz_data, 0, 3 ) ) { |
107 if ( str_starts_with( $gz_data, "\x1f\x8b\x08" ) ) { |
107 $i = 10; |
108 $i = 10; |
108 $flg = ord( substr( $gz_data, 3, 1 ) ); |
109 $flg = ord( substr( $gz_data, 3, 1 ) ); |
109 if ( $flg > 0 ) { |
110 if ( $flg > 0 ) { |
110 if ( $flg & 4 ) { |
111 if ( $flg & 4 ) { |
111 list($xlen) = unpack( 'v', substr( $gz_data, $i, 2 ) ); |
112 list($xlen) = unpack( 'v', substr( $gz_data, $i, 2 ) ); |