(bug 31176) {{SERVERNAME}} doesn't play nice with protocol-relative URLs
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 26 Sep 2011 23:14:20 +0000 (23:14 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 26 Sep 2011 23:14:20 +0000 (23:14 +0000)
includes/parser/Parser.php

index a183101..1fdbdc9 100644 (file)
@@ -2823,10 +2823,8 @@ class Parser {
                        case 'server':
                                return $wgServer;
                        case 'servername':
-                               wfSuppressWarnings(); # May give an E_WARNING in PHP < 5.3.3
-                               $serverName = parse_url( $wgServer, PHP_URL_HOST );
-                               wfRestoreWarnings();
-                               return $serverName ? $serverName : $wgServer;
+                               $serverParts = wfParseUrl( $wgServer, PHP_URL_HOST );
+                               return $serverParts && isset( $serverParts['host'] ) ? $serverParts['host'] : $wgServer;
                        case 'scriptpath':
                                return $wgScriptPath;
                        case 'stylepath':