From 7ac6b18d89eea2a5da95a9728c1a01ac78bc1879 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 25 Oct 2016 00:45:29 +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. Built from https://develop.svn.wordpress.org/trunk@38894 git-svn-id: http://core.svn.wordpress.org/trunk@38837 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 d07b77ae10..45eeeaf1a1 100644 --- a/wp-includes/class-http.php +++ b/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. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 1ed19bd65a..b213118098 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.