WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#36847 closed defect (bug) (duplicate)

PHP Fatal error: Cannot use object of type Requests_Response as array

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: HTTP API Keywords:
Focuses: Cc:

Description

I try update plugin in WordPress and I have fatal:

[16-May-2016 06:39:46 UTC] PHP Fatal error: Cannot use object of type Requests_Response as array in \wordpress\wp-includes\http.php on line 255

Plugins was updated.

My WordPress version: 4.6-alpha-37434

Problem is in:

<?php
/**
 * Retrieve only the response code from the raw response.
 *
 * Will return an empty array if incorrect parameter value is given.
 *
 * @since 2.7.0
 *
 * @param array $response HTTP response.
 * @return int|string The response code as an integer. Empty string on incorrect parameter given.
 */
function wp_remote_retrieve_response_code( $response ) {
        if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
                return '';

        return $response['response']['code'];
}

Change History (2)

#1 @rmccue
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Just fixed this in r37436. Can you update and try again please?

#2 @dd32
4 years ago

  • Resolution changed from worksforme to duplicate

Duplicate of #33055.

Note: See TracTickets for help on using tickets.