Make WordPress Core


Ignore:
Timestamp:
10/09/2014 03:00:16 AM (10 years ago)
Author:
dd32
Message:

Add some unit tests for WP_HTTP::parse_url() to cover the <PHP 5.4.7 compatibility alterations.

These unit tests cover the expected vehaviour of certain combinations of URL's, but makes no attempt to test invalid URL structures, as PHP's behavious for invalid URL's is undefined (Some will be treated as paths, others fail, and it varies between PHP 5.4.7+ and <5.4.7).
This change also makes WP_HTTP::parse_url() protected in order to allow unit testing.
See #28001, #29886

File:
1 edited

Legend:

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

    r29861 r29864  
    683683     * @since 4.1.0
    684684     *
    685      * @access private
     685     * @access protected
    686686     * @param  string $url The URL to parse
    687687     * @return bool|array False on failure; Array of URL components on success; See parse_url()'s return values.
    688688     */
    689     private static function parse_url( $url ) {
     689    protected static function parse_url( $url ) {
    690690        $parts = @parse_url( $url );
    691691        if ( ! $parts ) {
Note: See TracChangeset for help on using the changeset viewer.