HTTP: Call mbstring_binary_safe_encoding() before making a request with Requests to avoid issues with mbstring.func_overload.

Props SergeyBiryukov.
Fixes #38226.

Built from https://develop.svn.wordpress.org/trunk@38894


git-svn-id: http://core.svn.wordpress.org/trunk@38837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-10-25 00:45:29 +00:00
parent e8211f783a
commit 7ac6b18d89
2 changed files with 6 additions and 1 deletions

View File

@ -359,6 +359,9 @@ class WP_Http {
} }
} }
// Avoid issues where mbstring.func_overload is enabled
mbstring_binary_safe_encoding();
try { try {
$requests_response = Requests::request( $url, $headers, $data, $type, $options ); $requests_response = Requests::request( $url, $headers, $data, $type, $options );
@ -373,6 +376,8 @@ class WP_Http {
$response = new WP_Error( 'http_request_failed', $e->getMessage() ); $response = new WP_Error( 'http_request_failed', $e->getMessage() );
} }
reset_mbstring_encoding();
/** /**
* Fires after an HTTP API response is received and before the response is returned. * Fires after an HTTP API response is received and before the response is returned.
* *

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-alpha-38893'; $wp_version = '4.7-alpha-38894';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.