r95011 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95010‎ | r95011 | r95012 >
Date:15:56, 19 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Use wfParseUrl() instead of parse_url() in interwiki search code: the latter can throw PHP warnings and is totally broken for protocol-relative URLs. Also remove the last usage in core of key_exists(), a deprecated alias for array_key_exists()
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -775,13 +775,13 @@
776776 $out = "";
777777 // display project name
778778 if(is_null($lastInterwiki) || $lastInterwiki != $t->getInterwiki()) {
779 - if( key_exists($t->getInterwiki(),$customCaptions) ) {
 779+ if( array_key_exists($t->getInterwiki(),$customCaptions) ) {
780780 // captions from 'search-interwiki-custom'
781781 $caption = $customCaptions[$t->getInterwiki()];
782782 } else {
783783 // default is to show the hostname of the other wiki which might suck
784784 // if there are many wikis on one hostname
785 - $parsed = parse_url($t->getFullURL());
 785+ $parsed = wfParseUrl( $t->getFullURL() );
786786 $caption = wfMsg('search-interwiki-default', $parsed['host']);
787787 }
788788 // "more results" link (special page stuff could be localized, but we might not know target lang)

Follow-up revisions

RevisionCommit summaryAuthorDate
r955051.17wmf1: Merge a truckload of HTTPS / prot rel URL fixes: r93847, r94990, r9...catrope19:32, 25 August 2011
r964751.18: MFT r94737, r94990, r95000, r95001, r95002, r95006, r95007, r95010, r95...catrope19:37, 7 September 2011

Status & tagging log