WordPress.org

Make WordPress Core

Ticket #8591: 8591a.diff

File 8591a.diff, 2.7 KB (added by vladimir_kolesnikov, 9 years ago)
  • wp-includes/comment.php

     
    12611261
    12621262        $contents = $response['body'];
    12631263
     1264        if ( is_wp_error( $contents ) )
     1265                return false;
     1266
    12641267        $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
    12651268        $pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
    12661269        if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
  • wp-includes/functions.php

     
    12761276
    12771277        $response = wp_remote_get( $uri, $options );
    12781278
    1279         if ( is_wp_error( $response ) )
     1279        if ( is_wp_error( $response ) || is_wp_error( $response['body'] ) )
    12801280                return false;
    12811281
    12821282        return $response['body'];
  • wp-admin/update-links.php

     
    4141if ( is_wp_error( $response ) )
    4242        wp_die(__('Request Failed.'));
    4343
    44 if ( $response['response']['code'] != 200 )
     44if ( $response['response']['code'] != 200 || is_wp_error( $response['body'] ) )
    4545        wp_die(__('Request Failed.'));
    4646
    4747$body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
  • wp-admin/includes/plugin-install.php

     
    3939
    4040        if ( ! $res ) {
    4141                $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
    42                 if ( is_wp_error($request) ) {
     42                if ( is_wp_error($request) || is_wp_error($request['body']) ) {
    4343                        $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occured during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
    4444                } else {
    4545                        $res = unserialize($request['body']);
  • wp-admin/includes/file.php

     
    443443
    444444        $response = wp_remote_get($url, array('timeout' => 30));
    445445
    446         if ( is_wp_error($response) ) {
     446        if ( is_wp_error($response) || ( isset( $response['body'] ) && is_wp_error( $response['body'] ) ) ) {
    447447                fclose($handle);
    448448                unlink($tmpfname);
    449449                return $response;