Page MenuHomePhabricator

UserFactory::newFromName should handle no validation
Closed, ResolvedPublic


When UserFactory was introduced in T253432, a change was made to the signature of newFromName. User::newFromName accepts string|bool for the $validation param, but UserFactory::newFromName casts it to a string.

If User::newFromName is called with $validate = false, then User::getCanonicalName picks a default validation strategy:

But if false is passed to UserFactory::newFromName, it is cast to empty string, so it fails the above check and is never set to a valid strategy. An error is then thrown in UserNameUtils::getCanonical:

Related Objects

Event Timeline

Change 606007 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] UserFactory: Allow no validation with UserFactory::newFromName

Change 606007 merged by jenkins-bot:
[mediawiki/core@master] UserFactory: Document that newFromName expects a validation constant

DannyS712 assigned this task to Tchanders.