From f5f0032925c855385f906c59fc0d1855428a9208 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 25 Oct 2016 00:47:30 +0000 Subject: [PATCH] HTTP: Call `mbstring_binary_safe_encoding()` before making a request with Requests to avoid issues with `mbstring.func_overload`. Props SergeyBiryukov. Merges [38894] to the 4.6 branch. Fixes #38226. Built from https://develop.svn.wordpress.org/branches/4.6@38895 git-svn-id: http://core.svn.wordpress.org/branches/4.6@38838 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-http.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 914aa213f4..5a3075846c 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -363,6 +363,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 ); @@ -377,6 +380,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. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 65694c6f9a..d6aa295af2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6.2-alpha-38728'; +$wp_version = '4.6.2-alpha-38895'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.