Last modified: 2011-10-24 09:33:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33176, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31176 - {{SERVERNAME}} variable does not strip // for protocol relative urls
{{SERVERNAME}} variable does not strip // for protocol relative urls
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.18.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks: 20342
  Show dependency treegraph
 
Reported: 2011-09-26 23:07 UTC by Bawolff (Brian Wolff)
Modified: 2011-10-24 09:33 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bawolff (Brian Wolff) 2011-09-26 23:07:20 UTC
{{SERVERNAME}} is supposed to return just the host name. (As opposed to {{SERVER}} which is supposed to output the protocol and host)

Expected output on wikipedia:
{{SERVERNAME}} = en.wikipedia.org

Actual output (with protocol relative urls):
{{SERVERNAME}} = //en.wikipedia.org


(Someone else reported this on irc I believe)
Comment 1 Brion Vibber 2011-09-26 23:11:31 UTC
Looks like parse_url sees the whole lot as just a path '//foobar', so the fallback behavior returns $wgServer as a whole.
Comment 2 Brion Vibber 2011-09-26 23:12:23 UTC
Switching from parse_url() to wfParseUrl() should fix this, as it has workarounds specifically for those urls.
Comment 3 Daniel Friesen 2011-09-26 23:12:56 UTC
Just did a check. This would be a bug in parse_url, it doesn't understand protocol-relative urls, however wfParseUrl does understand protocol relatives. So the fix would be to use wfParseUrl instead of parse_url.
Comment 4 Roan Kattouw 2011-09-26 23:13:35 UTC
I have a fix, committing and deploying. It's long known to me that parse_url() is a piece of garbage and does not understand protocol-relative URLs.
Comment 5 Roan Kattouw 2011-09-26 23:15:43 UTC
Fixed in r98193, deploying. Needs a parser test or something, too, but it's past 1am so I'm not doing that now.
Comment 6 Huji 2011-09-27 03:01:37 UTC
Thanks Roan. The buggy version is now live on Wikimedia servers. I hope your fix will get through as fast as possible.
Comment 7 Roan Kattouw 2011-09-27 09:55:57 UTC
(In reply to comment #6)
> Thanks Roan. The buggy version is now live on Wikimedia servers. I hope your
> fix will get through as fast as possible.
I helps if I run svn up before scapping :D

So I accidentally did not deploy this last night, but I did just now. {{SERVERNAME}} now really works correctly on WMF wikis and the phishing site messages are gone.
Comment 8 Antoine "hashar" Musso (WMF) 2011-10-24 09:33:43 UTC
Test added with r100592.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links