From 62dc6e6dfa32997a703a0b8ee39397be5ea319b9 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Mon, 16 May 2016 06:11:58 +0000 Subject: [PATCH] HTTP API: Pass array-like object to http_api_debug. This was mistakingly passing the Requests_Response object, which caused fatal errors with debugging tools. See #33055. git-svn-id: https://develop.svn.wordpress.org/trunk@37436 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-http.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php index 7511c100ed..0a3b1c82bf 100644 --- a/src/wp-includes/class-http.php +++ b/src/wp-includes/class-http.php @@ -349,6 +349,9 @@ class WP_Http { try { $response = Requests::request( $url, $headers, $data, $type, $options ); + + // Convert the response into an array + $response = new WP_HTTP_Requests_Response( $response, $r['filename'] ); } catch ( Requests_Exception $e ) { $response = new WP_Error( 'http_request_failed', $e->getMessage() ); @@ -382,19 +385,16 @@ class WP_Http { ); } - // Convert the response into an array - $data = new WP_HTTP_Requests_Response( $response, $r['filename'] ); - /** * Filter the HTTP API response immediately before the response is returned. * * @since 2.9.0 * - * @param array $data HTTP response. - * @param array $r HTTP request arguments. - * @param string $url The request URL. + * @param array $response HTTP response. + * @param array $r HTTP request arguments. + * @param string $url The request URL. */ - return apply_filters( 'http_response', $data, $r, $url ); + return apply_filters( 'http_response', $response, $r, $url ); } /**