Make WordPress Core

Changeset 25051


Ignore:
Timestamp:
08/18/2013 08:17:48 AM (13 years ago)
Author:
dd32
Message:

WP_HTTP: Curl: When using Stream-to-file on servers using mbstring.func_overload ensure that the file is written out correctly. Props DrProtocols. See #25061 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-http.php

    r25046 r25051  
    13951395         */
    13961396        private function stream_body( $handle, $data ) {
     1397                if ( function_exists( 'ini_get' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ) && function_exists( 'mb_internal_encoding' ) ) {
     1398                        $mb_encoding = mb_internal_encoding();
     1399                        mb_internal_encoding( 'ISO-8859-1' );
     1400                }
     1401
    13971402                if ( $this->max_body_length && ( strlen( $this->body ) + strlen( $data ) ) > $this->max_body_length )
    13981403                        $data = substr( $data, 0, ( $this->max_body_length - strlen( $this->body ) ) );
     
    14031408                        $this->body .= $data;
    14041409
    1405                 return strlen( $data );
     1410                $data_length = strlen( $data );
     1411
     1412                if ( isset( $mb_encoding ) )
     1413                        mb_internal_encoding( $mb_encoding );
     1414
     1415                return $data_length;
    14061416        }
    14071417
Note: See TracChangeset for help on using the changeset viewer.