Message::inLanguage() shouldn't unstub StubUserLang
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 13 Apr 2015 15:40:30 +0000 (11:40 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 13 Apr 2015 15:40:30 +0000 (11:40 -0400)
commit351dc9e11f493aacec2c07e8aa10f608060fc79a
tree0cbe74b3b17bcfaca612e8453c2011977ab20bf0
parent1f1cdeebbfdc3582adb6cf9da10c6da73623aea5
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
includes/Message.php