mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
HTTP API: Switch back to returning an array.
The array-compatibility object we started returning in r37428 unfortunately isn't enough like an array. In particular, `is_array()` checks fail, despite the object implementing ArrayAccess. Mea culpa. This moves the WP_HTTP_Response object to a new http_response key in the array, and changes the value back to an actual array. Fixes #37097. See #33055. git-svn-id: https://develop.svn.wordpress.org/trunk@37989 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -348,10 +348,14 @@ class WP_Http {
|
||||
$options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'] );
|
||||
|
||||
try {
|
||||
$response = Requests::request( $url, $headers, $data, $type, $options );
|
||||
$requests_response = Requests::request( $url, $headers, $data, $type, $options );
|
||||
|
||||
// Convert the response into an array
|
||||
$response = new WP_HTTP_Requests_Response( $response, $r['filename'] );
|
||||
$http_response = new WP_HTTP_Requests_Response( $requests_response, $r['filename'] );
|
||||
$response = $http_response->to_array();
|
||||
|
||||
// Add the original object to the array.
|
||||
$response['http_response'] = $http_response;
|
||||
}
|
||||
catch ( Requests_Exception $e ) {
|
||||
$response = new WP_Error( 'http_request_failed', $e->getMessage() );
|
||||
@@ -382,6 +386,7 @@ class WP_Http {
|
||||
'message' => false,
|
||||
),
|
||||
'cookies' => array(),
|
||||
'http_response' => null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user