Avoid string offset notices in [25319] (merged as [25324]). Merges [25340] to 3.6.

Built from https://develop.svn.wordpress.org/branches/3.6@25341


git-svn-id: http://core.svn.wordpress.org/branches/3.6@25303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-09-11 04:00:03 +00:00
parent a2b1caaaee
commit 18dba66bfb
1 changed files with 2 additions and 2 deletions

View File

@ -2239,12 +2239,12 @@ function set_url_scheme( $url, $scheme = null ) {
}
$url = trim( $url );
if ( $url[0] === '/' && $url[1] === '/' )
if ( substr( $url, 0, 2 ) === '//' )
$url = 'http:' . $url;
if ( 'relative' == $scheme ) {
$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
if ( $url[0] === '/' )
if ( $url !== '' && $url[0] === '/' )
$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
} else {
$url = preg_replace( '#^\w+://#', $scheme . '://', $url );