WP_HTTP can cause PHP Warnings during attempted decompression
|Reported by:||dd32||Owned by:|
|Component:||HTTP API||Keywords:||has-patch needs-testing|
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.