Make WordPress Core


Ignore:
Timestamp:
07/06/2016 05:50:44 PM (9 years ago)
Author:
rmccue
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/http/functions.php

    r37428 r37989  
    2323        $this->assertEquals( '40148', $headers['content-length'] );
    2424        $this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
     25    }
     26
     27    /**
     28     * @depends test_head_request
     29     */
     30    function test_returns_array() {
     31        $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
     32        $response = wp_remote_head( $url );
     33        $this->assertInternalType( 'array', $response );
    2534    }
    2635
Note: See TracChangeset for help on using the changeset viewer.