From: Brad Jorsch Date: Mon, 13 Apr 2015 15:40:30 +0000 (-0400) Subject: Message::inLanguage() shouldn't unstub StubUserLang X-Git-Tag: 1.31.0-rc.0~11709^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=351dc9e11f493aacec2c07e8aa10f608060fc79a;p=lhc%2Fweb%2Fwiklou.git Message::inLanguage() shouldn't unstub StubUserLang When a string is passed to Message::inLanguage(), it first checks whether the message's current language's code is equal to the string, to avoid a call to Language::factory(). But if the message's current language is an instance of StubUserLang, it's probably less expensive to just call Language::factory() than it is to unstub. This also avoids a possible recursion warning from T56193, particularly if inLanguage() is being used intentionally in an attempt to avoid that warning. Change-Id: Ia09adec05cfbb09c09e07c6be1e2d613435664d9 --- diff --git a/includes/Message.php b/includes/Message.php index 134af0ed45..4935e33946 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -597,7 +597,7 @@ class Message implements MessageSpecifier { if ( $lang instanceof Language || $lang instanceof StubUserLang ) { $this->language = $lang; } elseif ( is_string( $lang ) ) { - if ( $this->language->getCode() != $lang ) { + if ( !$this->language instanceof Language || $this->language->getCode() != $lang ) { $this->language = Language::factory( $lang ); } } else {