* @file
* @ingroup Site
*
- * @licence GNU GPL v2+
+ * @license GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
* @author Daniel Werner
*/
$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;
}
/**