Make Title::makeTitleSafe() not need user variant
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 19 Nov 2014 17:51:27 +0000 (12:51 -0500)
committerAnomie <bjorsch@wikimedia.org>
Wed, 19 Nov 2014 18:22:32 +0000 (18:22 +0000)
commitb27e460b26d95c0b89b13cfd66d9a52a143eca2a
tree2eb82df354d311d7c8410afe0b7748fb98c9929c
parent71b56ffff4fbef2360ff02ed8a0fd1ee61585fd8
Make Title::makeTitleSafe() not need user variant

In trying to avoid hitting RequestContext::getLanguage() from a call to
User::idFromName(), I05aacd30 made it no longer safe for user input.

A closer analysis of the call stack involved reveals that
Title::makeTitleSafe() is constructing a prefixed dbkey using the
localized name for NS_USER, and then Language::getNsIndex() is needing
to get the variant in order to handle that localized name. But if we use
the canonical name for NS_USER, Language::getNsIndex() short-circuits
and skips the problematic code path.

And it turns out that it doesn't actually matter which prefix
Title::makeTitleSafe() uses, since the prefix doesn't make it anywhere
into the resulting Title object. So let's revert I05aacd30 and Ibeef0409
and just do that instead.

Change-Id: Ib902573996c69d1e77527cc7b2faf4e7fa5d3daf
includes/Title.php
includes/User.php