Page MenuHomePhabricator

allow lower-case user names
Open, LowPublic


Brion did work long ago {T4290: Disallow usernames that are too similar to existing names (confusables, impersonation)} to make sure usernames with different capitalisation wouldn't conflict. I've created users with an initial lower case letter and found that they work.

These users show up on an un-modified MediaWiki's RecentChanges page. You can search for the uploads on ListFiles. However some pages do not show these users.

For example, even though the user "lowercaseUser" had been created, going to [[User:lowercaseUser]], [[Special:UserRights/lowercaseUser]] and [[Special:Contributions/lowecaseUser]] would say the user doesn't exist.

Upon examination, all these cases relied on the value of the private MWNamespace::$ $alwaysCapitalizedNamespaces. Removing NS_USER from that list allowed the special pages to understand that the user existed and act accordingly. (Note, I also removed a couple of ucfirst() calls in User.php.)

Since T4290 ensures that users won't be able to create a user named "LowercaseUser", and "lowercaseUser" is only allowed normally if $wgCapitalLinks is false (not the default), I think this is a safe change.


Related Gerrit Patches:

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 18 2016, 10:37 PM

Note that I have found that the following code from 2005 in User::isValidUserName() causes problems here since it assumes all namespaces are treated the same. That is, setting

$wgCapitalLinks = false

works, but

$wgCapitalLinkOverrides[NS_USER] = false;

does not. However,

$wgCapitalLinkOverrides[NS_USER] = false;
$wgCapitalLinkOverrides[NS_MAIN] = false;

works since NS_MAIN can have lower case titles and the comparision in the following code treats a name as though it was in the main namespace.

		// Ensure that the name can't be misresolved as a different title,
		// such as with extra namespace keys at the start.
		$parsed = Title::newFromText( $name );
		if ( is_null( $parsed )
			|| $parsed->getNamespace()
			|| strcmp( $name, $parsed->getPrefixedText() ) ) {
			return false;

Change 295101 had a related patch set uploaded (by MarkAHershberger):
Allow usernames with an initial lowercase letter.

Aklapper triaged this task as Low priority.Jun 19 2016, 11:51 AM

Might be a idea to setup a test instance on labs to make sure extensions work as desired with the changes.

A lot of extensions are going to require updates... (I trimmed what looked like irrelevant matches from the below grep)

km@km-tp ~/p/v/m/extensions> ack \\\-\\\>ucfirst --php
101:		$userName = $this->getLanguage()->ucfirst( $userName );

95:			$userName = $this->getLanguage()->ucfirst( $userName );

54:			$this->mPrefixSearch = $this->getLanguage()->ucfirst( trim( $this->mPrefixSearch ) );
94:			$username = $this->getLanguage()->ucfirst( $username );

51:		$this->mUserName = $wgContLang->ucfirst( $this->mUserName );

31:		$rqUsername = $wgContLang->ucfirst( $req->getVal( 'username' ) );

290:		$name = $wgContLang->ucfirst( $this->getRequest()->getVal( 'wpName' ) );

373:		$newusername = Title::makeTitleSafe( NS_USER, $wgContLang->ucfirst( $this->newUser->getName() ) );

59:		$newusername = Title::makeTitleSafe( NS_USER, $wgContLang->ucfirst( $request->getText( 'newusername' ) ) );

56:		$newusername = Title::makeTitleSafe( NS_USER, $wgContLang->ucfirst( $newnamePar ) );
256:		if ( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) {

363:				$memberName = $this->getLanguage()->ucfirst( $memberName );

63:		$name = $wgContLang->ucfirst($name);
158:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));
177:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));
242:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));
291:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));

There's also probably a lot of third-party code making this assumption, e.g. scripts and API clients.

Change 295101 abandoned by MarkAHershberger:
Allow usernames with an initial lowercase letter.

Krinkle removed a subscriber: Krinkle.Apr 6 2018, 5:35 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptJun 1 2019, 8:24 PM