diff --git a/wp-includes/http.php b/wp-includes/http.php index b47c87b22..fffe764bc 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -412,7 +412,7 @@ class WP_Http { * @static * * @param string $body Body content - * @return bool|string|WP_Error False if not chunked encoded. WP_Error on failure. Chunked decoded body on success. + * @return string Chunked decoded body on success or raw body on failure. */ function chunkTransferDecode($body) { $body = str_replace(array("\r\n", "\r"), "\n", $body); @@ -423,15 +423,12 @@ class WP_Http { $parsedBody = ''; //$parsedHeaders = array(); Unsupported - $done = false; - - do { + while ( true ) { $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match ); if ( $hasChunk ) { - if ( empty($match[1]) ) { + if ( empty( $match[1] ) ) return $body; - } $length = hexdec( $match[1] ); $chunkLength = strlen( $match[0] ); @@ -441,15 +438,12 @@ class WP_Http { $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n"); - if( "0" == trim($body) ) { - $done = true; + if( "0" == trim($body) ) return $parsedBody; // Ignore footer headers. - break; - } } else { return $body; } - } while ( true === $done ); + } } }