From: umherirrender Date: Sat, 10 May 2014 08:41:30 +0000 (+0200) Subject: Fix title handling in User::getCanonicalName X-Git-Tag: 1.31.0-rc.0~14651^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=1ef57be80aabbeb3ec6f2a02862a32aaf4f231fc;p=lhc%2Fweb%2Fwiklou.git Fix title handling in User::getCanonicalName With r41328 the title validation was changed to allow rename of invalid user names, by always creating a title object. That removes the title validation for validation of 'usable' and 'creatable', but in that case it is also a good idea to apply title rules to normalize spaces and reject user names which can not have a valid title. At the moment that is done in User::isValidUserName. Change-Id: I27c488e4008a924117ff6bac2216f148cd5e7abd --- diff --git a/includes/User.php b/includes/User.php index fa20ebdaa6..af5bc3dc78 100644 --- a/includes/User.php +++ b/includes/User.php @@ -918,8 +918,9 @@ class User implements IDBAccessObject { return false; } - // Clean up name according to title rules - $t = ( $validate === 'valid' ) ? + // Clean up name according to title rules, + // but only when validation is requested (bug 12654) + $t = ( $validate !== false ) ? Title::newFromText( $name ) : Title::makeTitle( NS_USER, $name ); // Check for invalid titles if ( is_null( $t ) ) {