From: Fomafix Date: Fri, 17 Aug 2018 16:06:47 +0000 (+0200) Subject: Message: Fix error on getTitle() without language X-Git-Tag: 1.34.0-rc.0~4400 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=68ddb83f62a41f987797368949433bf5b932f040;p=lhc%2Fweb%2Fwiklou.git Message: Fix error on getTitle() without language Steps to reproduce: Old: > $msg = new Message( 'brackets' ) > print $msg->getTitle() Error from line 478 of /.../includes/Message.php: Call to a member function equals() on boolean New: > $msg = new Message( 'brackets' ) > print $msg->getTitle() MediaWiki:Brackets This got broken in 796d62d0. Change-Id: I52cde36787e348378c4df18d90aa577a5600e06b --- diff --git a/includes/Message.php b/includes/Message.php index e2fe254f60..3bd775537f 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -473,13 +473,13 @@ class Message implements MessageSpecifier, Serializable { global $wgForceUIMsgAsContentMsg; $contLang = MediaWikiServices::getInstance()->getContentLanguage(); + $lang = $this->getLanguage(); $title = $this->key; if ( - !$this->language->equals( $contLang ) + !$lang->equals( $contLang ) && in_array( $this->key, (array)$wgForceUIMsgAsContentMsg ) ) { - $code = $this->language->getCode(); - $title .= '/' . $code; + $title .= '/' . $lang->getCode(); } return Title::makeTitle(