Make WordPress Core

Changeset 40068


Ignore:
Timestamp:
02/17/2017 05:05:03 AM (8 years ago)
Author:
dd32
Message:

HTTP API: Restore backwards compatibility with the http_api_curl filter - it expects that the handle parameter is passed as a reference, however [39212] missed that.

Props pento.
Fixes #39783.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-http-requests-hooks.php

    r39212 r40068  
    5555            case 'curl.before_send':
    5656                /** This action is documented in wp-includes/class-wp-http-curl.php */
    57                 do_action_ref_array( 'http_api_curl', array( $parameters[0], $this->request, $this->url ) );
     57                do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) );
    5858                break;
    5959        }
  • trunk/tests/phpunit/tests/http/curl.php

    r25002 r40068  
    99class Tests_HTTP_curl extends WP_HTTP_UnitTestCase {
    1010    var $transport = 'curl';
     11
     12    /**
     13     * @ticket 39783
     14     */
     15    public function test_http_api_curl_stream_parameter_is_a_reference() {
     16        add_action( 'http_api_curl', array( $this, '_action_test_http_api_curl_stream_parameter_is_a_reference' ), 10, 3 );
     17        wp_remote_request( $this->fileStreamUrl, array( 'stream' => true, 'timeout' => 30 ) );
     18        remove_action( 'http_api_curl', array( $this, '_action_test_http_api_curl_stream_parameter_is_a_reference' ), 10 );
     19    }
     20
     21    public function _action_test_http_api_curl_stream_parameter_is_a_reference( &$stream, $r, $url ) {
     22        // $stream not being a reference will cause a PHP warning.
     23        // For counting tests purposes, let's do a fake assert.
     24        $this->assertTrue( true );
     25    }
    1126}
Note: See TracChangeset for help on using the changeset viewer.