Follow-up to I05aacd30b: normalize case in User::idFromName
authorOri Livneh <ori@wikimedia.org>
Tue, 18 Nov 2014 22:42:18 +0000 (14:42 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 19 Nov 2014 04:03:44 +0000 (20:03 -0800)
Change-Id: Ibeef04093338bfef8e65f40b1f9db588c8d5a79d

includes/User.php

index f9f4b6a..feaf364 100644 (file)
@@ -565,14 +565,15 @@ class User implements IDBAccessObject {
         * @return int|null The corresponding user's ID, or null if user is nonexistent
         */
        public static function idFromName( $name ) {
-               // We don't want to call Title::makeTitleSafe yet, since that call path
-               // ends up needing the user language, which ends up trying to load the
-               // user object, which ends up back here (bug 54193).
-               $nt = Title::makeTitle( NS_USER, $name );
                if ( isset( self::$idCacheByName[$name] ) ) {
                        return self::$idCacheByName[$name];
                }
 
+               // We don't want to call Title::makeTitleSafe yet, since that call path
+               // ends up needing the user language, which ends up trying to load the
+               // user object, which ends up back here (bug 54193).
+               $nt = Title::makeTitle( NS_USER, Title::capitalize( $name, NS_USER ) );
+
                $dbr = wfGetDB( DB_SLAVE );
                $s = $dbr->selectRow(
                        'user',