Make WordPress Core

Opened 5 years ago

Last modified 11 months ago

#22952 closed defect (bug)

WP_HTTP can cause PHP Warnings during attempted decompression — at Version 1

Reported by: dd32 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: HTTP API Keywords: has-patch needs-testing
Focuses: Cc:

Description (last modified by SergeyBiryukov)

WARNING: wp-includes/class-http.php:1656 - gzinflate(): data error

WP_Http_Encoding can cause PHP Warnings when it attempts to decompress data using gzinflate() which has been encoded in any way.
We currently work around this this in a few ways, but we still take a "try it and see" method instead of detecting the compressed contents signature and handling it appropriately.

Attached is a first-run patch at detecting Huffman coding, which is what we currently use @gzinflate( substr( $gzData, 2 ) ) for (and hey, who doesn't like making magic numbers clearer?)

I have been running a similar patch on WordPress.com and gathering data on how the myriad of different Web Servers out there respond, and so far this causes it to correctly identify the vast majority of responses.

It appears that we may also be attempting to decompress compressed files retrieved through WP_HTTP on some poorly configured servers, but this is something I haven't yet traced properly.

Change History (2)

5 years ago

#1 @SergeyBiryukov
5 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.