Clean up: Fix trailing comments from I7e22cc3c
[lhc/web/wiklou.git] / includes / site / SiteObject.php
index 7f143d1..0c6aeb3 100644 (file)
@@ -23,7 +23,7 @@
  * @file
  * @ingroup Site
  *
- * @licence GNU GPL v2+
+ * @license GNU GPL v2+
  * @author Jeroen De Dauw < jeroendedauw@gmail.com >
  * @author Daniel Werner
  */
@@ -157,10 +157,23 @@ class SiteObject extends ORMRow implements Site {
                $path = $this->getLinkPath();
 
                if ( $path === false ) {
-                       return false;
+                       return '';
+               }
+
+               $protocol = parse_url( $path, PHP_URL_SCHEME );
+
+               // Malformed URL
+               if ( $protocol === false ) {
+                       throw new MWException( "failed to parse URL $path" );
+               }
+
+               // No schema
+               if ( $protocol === null ) {
+                       // Used for protocol relative URLs
+                       $protocol = '';
                }
 
-               return parse_url( $path, PHP_URL_SCHEME );
+               return $protocol;
        }
 
        /**