Page MenuHomePhabricator

TypeError: Argument 1 passed to MediaWiki\User\UserFactory::newFromName() must be of the type string, null given, called in /srv/mediawiki/php-1.41.0-wmf.24/extensions/LoginNotify/includes/Hooks.php on line 42
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   TypeError: Argument 1 passed to MediaWiki\User\UserFactory::newFromName() must be of the type string, null given, called in /srv/mediawiki/php-1.41.0-wmf.24/extensions/LoginNotify/includes/Hooks.php on line 42
error.stack_trace
from /srv/mediawiki/php-1.41.0-wmf.24/includes/user/UserFactory.php(105)
#0 /srv/mediawiki/php-1.41.0-wmf.24/extensions/LoginNotify/includes/Hooks.php(42): MediaWiki\User\UserFactory->newFromName(NULL, string)
#1 /srv/mediawiki/php-1.41.0-wmf.24/includes/HookContainer/HookContainer.php(161): LoginNotify\Hooks->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, NULL, NULL, array)
#2 /srv/mediawiki/php-1.41.0-wmf.24/includes/HookContainer/HookRunner.php(890): MediaWiki\HookContainer\HookContainer->run(string, array)
#3 /srv/mediawiki/php-1.41.0-wmf.24/includes/auth/AuthManager.php(581): MediaWiki\HookContainer\HookRunner->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, NULL, NULL, array)
#4 /srv/mediawiki/php-1.41.0-wmf.24/includes/auth/AuthManager.php(487): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#5 /srv/mediawiki/php-1.41.0-wmf.24/includes/specialpage/AuthManagerSpecialPage.php(375): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#6 /srv/mediawiki/php-1.41.0-wmf.24/includes/specialpage/AuthManagerSpecialPage.php(507): AuthManagerSpecialPage->performAuthenticationStep(string, array)
#7 /srv/mediawiki/php-1.41.0-wmf.24/includes/htmlform/HTMLForm.php(749): AuthManagerSpecialPage->handleFormSubmit(array, CodexHTMLForm)
#8 /srv/mediawiki/php-1.41.0-wmf.24/includes/specialpage/AuthManagerSpecialPage.php(438): HTMLForm->trySubmit()
#9 /srv/mediawiki/php-1.41.0-wmf.24/includes/specialpage/LoginSignupSpecialPage.php(318): AuthManagerSpecialPage->trySubmit()
#10 /srv/mediawiki/php-1.41.0-wmf.24/includes/specialpage/SpecialPage.php(701): LoginSignupSpecialPage->execute(NULL)
#11 /srv/mediawiki/php-1.41.0-wmf.24/includes/specialpage/SpecialPageFactory.php(1566): SpecialPage->run(NULL)
#12 /srv/mediawiki/php-1.41.0-wmf.24/includes/MediaWiki.php(344): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#13 /srv/mediawiki/php-1.41.0-wmf.24/includes/MediaWiki.php(942): MediaWiki->performRequest()
#14 /srv/mediawiki/php-1.41.0-wmf.24/includes/MediaWiki.php(591): MediaWiki->main()
#15 /srv/mediawiki/php-1.41.0-wmf.24/index.php(50): MediaWiki->run()
#16 /srv/mediawiki/php-1.41.0-wmf.24/index.php(46): wfIndexMain()
#17 /srv/mediawiki/w/index.php(3): require(string)
#18 {main}
Notes
  • Seeing a little less than one an hour for these across multiple wikis
  • Superficially similar to the CheckUser error from T310747

Event Timeline

Change 954116 had a related patch set uploaded (by Ammarpad; author: Ammarpad):

[mediawiki/extensions/LoginNotify@master] Hooks: Do not attempt user creation when there's no username

https://gerrit.wikimedia.org/r/954116

User::newFromName() casts the name to a string. I changed it to use UserFactory in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/LoginNotify/+/952114 but UserFactory::newFromName() throws an exception instead of casting.

Change 953662 had a related patch set uploaded (by Tim Starling; author: Ammarpad):

[mediawiki/extensions/LoginNotify@wmf/1.41.0-wmf.24] Hooks: Do not attempt user creation when there's no username

https://gerrit.wikimedia.org/r/953662

Change 954116 merged by jenkins-bot:

[mediawiki/extensions/LoginNotify@master] Hooks: Do not attempt user creation when there's no username

https://gerrit.wikimedia.org/r/954116

The core documentation issue was fixed in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/954121 . The incorrect doc comment also exists in CheckUser so I will fix it there too.

Change 954145 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/extensions/CheckUser@master] Fix type of $username in AuthManagerLoginAuthenticateAuditHook

https://gerrit.wikimedia.org/r/954145

Change 953662 merged by jenkins-bot:

[mediawiki/extensions/LoginNotify@wmf/1.41.0-wmf.24] Hooks: Do not attempt user creation when there's no username

https://gerrit.wikimedia.org/r/953662

Mentioned in SAL (#wikimedia-operations) [2023-09-01T00:43:29Z] <tstarling@deploy1002> Synchronized php-1.41.0-wmf.24/extensions/LoginNotify/includes/Hooks.php: fix production error T345373 (duration: 06m 13s)

tstarling claimed this task.

Logstash only shows 5 errors in the past 24 hours, so I am assuming that it is fixed rather than confirming.

Change 954145 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Fix type of $username in AuthManagerLoginAuthenticateAuditHook

https://gerrit.wikimedia.org/r/954145