Make WordPress Core

Ticket #8618: 8618.2.diff

File 8618.2.diff, 1.2 KB (added by jacobsantos, 16 years ago)

Fix for the fix on trunk.

  • http.php

     
    412412         * @static
    413413         *
    414414         * @param string $body Body content
    415          * @return bool|string|WP_Error False if not chunked encoded. WP_Error on failure. Chunked decoded body on success.
     415         * @return string Chunked decoded body on success or raw body on failure.
    416416         */
    417417        function chunkTransferDecode($body) {
    418418                $body = str_replace(array("\r\n", "\r"), "\n", $body);
     
    423423                $parsedBody = '';
    424424                //$parsedHeaders = array(); Unsupported
    425425
    426                 $done = false;
    427 
    428                 do {
     426                while ( true ) {
    429427                        $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
    430428
    431429                        if ( $hasChunk ) {
    432                                 if ( empty($match[1]) ) {
     430                                if ( empty( $match[1] ) )
    433431                                        return $body;
    434                                 }
    435432
    436433                                $length = hexdec( $match[1] );
    437434                                $chunkLength = strlen( $match[0] );
     
    441438
    442439                                $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
    443440
    444                                 if( "0" == trim($body) ) {
    445                                         $done = true;
     441                                if( "0" == trim($body) )
    446442                                        return $parsedBody; // Ignore footer headers.
    447                                         break;
    448                                 }
    449443                        } else {
    450444                                return $body;
    451445                        }
    452                 } while ( true === $done );
     446                }
    453447        }
    454448}
    455449