Guard against parse_url() returning weird things in wfParseUrl(). This is not a probl...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 12 Aug 2011 14:45:37 +0000 (14:45 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 12 Aug 2011 14:45:37 +0000 (14:45 +0000)
includes/GlobalFunctions.php

index 98a1ea7..3c48d72 100644 (file)
@@ -516,7 +516,9 @@ function wfParseUrl( $url ) {
        wfSuppressWarnings();
        $bits = parse_url( $url );
        wfRestoreWarnings();
-       if ( !$bits ) {
+       // parse_url() returns an array without scheme for some invalid URLs, e.g.
+       // parse_url("%0Ahttp://example.com") == array( 'host' => '%0Ahttp', 'path' => 'example.com' )
+       if ( !$bits || !isset( $bits['scheme'] ) ) {
                return false;
        }