WordPress.org

Make WordPress Core

Ticket #8620: http.diff

File http.diff, 2.1 KB (added by momo360modena, 9 years ago)
  • wp-includes/http.php

     
    11761176 * @return array The headers of the response. Empty array if incorrect parameter given.
    11771177 */
    11781178function wp_remote_retrieve_headers(&$response) {
    1179         if ( ! isset($response['headers']) || ! is_array($response['headers']))
     1179        if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']) )
    11801180                return array();
    11811181
    11821182        return $response['headers'];
     
    11921192 * @return array The header value. Empty string on if incorrect parameter given.
    11931193 */
    11941194function wp_remote_retrieve_header(&$response, $header) {
    1195         if ( ! isset($response['headers']) || ! is_array($response['headers']))
     1195        if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']) )
    11961196                return '';
    11971197
    11981198        if ( array_key_exists($header, $response['headers']) )
     
    12121212 * @return array The keys 'code' and 'message' give information on the response.
    12131213 */
    12141214function wp_remote_retrieve_response_code(&$response) {
    1215         if ( ! isset($response['response']) || ! is_array($response['response']))
     1215        if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']) )
    12161216                return '';
    12171217
    12181218        return $response['response']['code'];
     
    12291229 * @return array The keys 'code' and 'message' give information on the response.
    12301230 */
    12311231function wp_remote_retrieve_response_message(&$response) {
    1232         if ( ! isset($response['response']) || ! is_array($response['response']))
     1232        if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']) )
    12331233                return '';
    12341234
    12351235        return $response['response']['message'];
     
    12441244 * @return string The body of the response. Empty string if no body or incorrect parameter given.
    12451245 */
    12461246function wp_remote_retrieve_body(&$response) {
    1247         if ( ! isset($response['body']) )
     1247        if ( is_wp_error($response) || ! isset($response['body']) )
    12481248                return '';
    12491249
    12501250        return $response['body'];