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

Props SergeyBiryukov.
Fixes #38226.


git-svn-id: https://develop.svn.wordpress.org/trunk@38894 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2016-10-25 00:44:13 +00:00
parent cedd323452
commit 3df3b11e98
1 changed files with 5 additions and 0 deletions

View File

@ -359,6 +359,9 @@ class WP_Http {
}
}
// Avoid issues where mbstring.func_overload is enabled
mbstring_binary_safe_encoding();
try {
$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() );
}
reset_mbstring_encoding();
/**
* Fires after an HTTP API response is received and before the response is returned.
*