WordPress.org

Make WordPress Core

Changeset 25324


Ignore:
Timestamp:
09/10/2013 06:43:16 PM (6 years ago)
Author:
nacin
Message:

Better protocol validation in set_url_scheme(). Merges [25319] to 3.6.

Location:
branches/3.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.6

  • branches/3.6/wp-includes/link-template.php

    r24941 r25324  
    22392239    }
    22402240
    2241     if ( 'relative' == $scheme )
    2242         $url = preg_replace( '#^.+://[^/]*#', '', $url );
    2243     else
    2244         $url = preg_replace( '#^.+://#', $scheme . '://', $url );
     2241    $url = trim( $url );
     2242    if ( $url[0] === '/' && $url[1] === '/' )
     2243        $url = 'http:' . $url;
     2244
     2245    if ( 'relative' == $scheme ) {
     2246        $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
     2247        if ( $url[0] === '/' )
     2248            $url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
     2249    } else {
     2250        $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
     2251    }
    22452252
    22462253    return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
Note: See TracChangeset for help on using the changeset viewer.