From b7474f07431c51761762e0cbb104388f045aad8e Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Fri, 12 Aug 2011 14:55:25 +0000 Subject: [PATCH] Followup r94349; Interwiki::getURL used `$title != null` to test if the $title arg was passed and should be substituted. However `"" == null`, so as a result switching to using the argument broke [[mw:]] style interwiki links without an article title. Update the Interwiki::getURL code to use isset(), and update the comment to tell pre-1.19 supporting extensions to do the entire urlencoding and $1 substitution on their own since Interwiki::getURL was essentially buggy and broken before now. --- includes/interwiki/Interwiki.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/interwiki/Interwiki.php b/includes/interwiki/Interwiki.php index 1ba0f106d8..711fea4969 100644 --- a/includes/interwiki/Interwiki.php +++ b/includes/interwiki/Interwiki.php @@ -315,13 +315,13 @@ class Interwiki { * * @param $title String: what text to put for the article name * @return String: the URL - * @note Prior to 1.19 getURL did not urlencode the $title, if you use this - * arg in an extension that supports MW earlier than 1.19 please ensure - * you wfUrlencode it when installed in earlier versions of MW. + * @note Prior to 1.19 The getURL with an argument was broken. + * If you if you use this arg in an extension that supports MW earlier + * than 1.19 please wfUrlencode and substitute $1 on your own. */ public function getURL( $title = null ) { $url = $this->mURL; - if( $title != null ) { + if( isset($title) ) { $url = str_replace( "$1", wfUrlencode( $title ), $url ); } return $url; -- 2.20.1