From 3df3b11e980c2121b2ac122a208f58ddebeccd34 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 25 Oct 2016 00:44:13 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-http.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php index d07b77ae10..45eeeaf1a1 100644 --- a/src/wp-includes/class-http.php +++ b/src/wp-includes/class-http.php @@ -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. *