r98193 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98192‎ | r98193 | r98194 >
Date:23:14, 26 September 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
(bug 31176) {{SERVERNAME}} doesn't play nice with protocol-relative URLs
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -2823,10 +2823,8 @@
28242824 case 'server':
28252825 return $wgServer;
28262826 case 'servername':
2827 - wfSuppressWarnings(); # May give an E_WARNING in PHP < 5.3.3
2828 - $serverName = parse_url( $wgServer, PHP_URL_HOST );
2829 - wfRestoreWarnings();
2830 - return $serverName ? $serverName : $wgServer;
 2827+ $serverParts = wfParseUrl( $wgServer, PHP_URL_HOST );
 2828+ return $serverParts && isset( $serverParts['host'] ) ? $serverParts['host'] : $wgServer;
28312829 case 'scriptpath':
28322830 return $wgScriptPath;
28332831 case 'stylepath':

Follow-up revisions

RevisionCommit summaryAuthorDate
r98194Fix stupid typo in r98193, thanks Dantmancatrope23:16, 26 September 2011
r981951.18wmf1: MFT r98193, r98194catrope23:17, 26 September 2011
r981971.17wmf1: MFT r98193, r98194catrope23:18, 26 September 2011
r98762REL1_18 MFT r97806, r97895, r98193, r98194, r98237, r98502, r98656, r98707, r...reedy13:56, 3 October 2011
r100592test {{SERVERNAME}} with relative URLS...hashar09:32, 24 October 2011

Comments

#Comment by Hashar (talk | contribs)   09:34, 24 October 2011

removing 'needs-parsertests' keyword. Test added in PHPUnit with r100592.

Status & tagging log