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 3.6

Built from https://develop.svn.wordpress.org/branches/3.6@25052


git-svn-id: http://core.svn.wordpress.org/branches/3.6@25039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-08-18 08:22:03 +00:00
parent c20fb5af65
commit 5f7f39240d
1 changed files with 11 additions and 1 deletions

View File

@ -1302,6 +1302,11 @@ class WP_Http_Curl {
* @return int
*/
private function stream_body( $handle, $data ) {
if ( function_exists( 'ini_get' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ) && function_exists( 'mb_internal_encoding' ) ) {
$mb_encoding = mb_internal_encoding();
mb_internal_encoding( 'ISO-8859-1' );
}
if ( $this->max_body_length && ( strlen( $this->body ) + strlen( $data ) ) > $this->max_body_length )
$data = substr( $data, 0, ( $this->max_body_length - strlen( $this->body ) ) );
@ -1310,7 +1315,12 @@ class WP_Http_Curl {
else
$this->body .= $data;
return strlen( $data );
$data_length = strlen( $data );
if ( isset( $mb_encoding ) )
mb_internal_encoding( $mb_encoding );
return $data_length;
}
/**