Page MenuHomePhabricator

TypeError: MediaWiki\Extension\OATHAuth\Key\TOTPKey::newFromArray(): Argument #1 ($data) must be of type array, null given
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

When registering a new TOTP device:

[aOe7EIEwraeM5RBlgC0CpgAAAAs] /enwiki/w/index.php?addsuccess=Authenticator+app&title=Special:AccountSecurity TypeError: MediaWiki\Extension\OATHAuth\Key\TOTPKey::newFromArray(): Argument #1 ($data) must be of type array, null given, called in /srv/mediawiki/php-master/extensions/OATHAuth/src/HTMLForm/KeySessionStorageTrait.php on line 32

Backtrace:

from /srv/mediawiki/php-master/extensions/OATHAuth/src/Key/TOTPKey.php(95)
#0 /srv/mediawiki/php-master/extensions/OATHAuth/src/HTMLForm/KeySessionStorageTrait.php(32): MediaWiki\Extension\OATHAuth\Key\TOTPKey::newFromArray(null)
#1 /srv/mediawiki/php-master/extensions/OATHAuth/src/HTMLForm/TOTPEnableForm.php(52): MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm->setKeyDataInSession(string)
#2 /srv/mediawiki/php-master/extensions/OATHAuth/src/HTMLForm/OATHAuthOOUIHTMLForm.php(55): MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm->getDescriptors()
#3 /srv/mediawiki/php-master/extensions/OATHAuth/src/Module/TOTP.php(115): MediaWiki\Extension\OATHAuth\HTMLForm\OATHAuthOOUIHTMLForm->__construct(MediaWiki\Extension\OATHAuth\OATHUser, MediaWiki\Extension\OATHAuth\OATHUserRepository, MediaWiki\Extension\OATHAuth\Module\TOTP, MediaWiki\Context\RequestContext)
#4 /srv/mediawiki/php-master/extensions/OATHAuth/src/Special/OATHManage.php(563): MediaWiki\Extension\OATHAuth\Module\TOTP->getManageForm(string, MediaWiki\Extension\OATHAuth\OATHUser, MediaWiki\Extension\OATHAuth\OATHUserRepository, MediaWiki\Context\RequestContext)
#5 /srv/mediawiki/php-master/extensions/OATHAuth/src/Special/OATHManage.php(672): MediaWiki\Extension\OATHAuth\Special\OATHManage->isModuleAvailable(MediaWiki\Extension\OATHAuth\Module\TOTP)
#6 /srv/mediawiki/php-master/extensions/OATHAuth/src/Special/OATHManage.php(850): MediaWiki\Extension\OATHAuth\Special\OATHManage->getSpecialModules()
#7 /srv/mediawiki/php-master/extensions/OATHAuth/src/Special/OATHManage.php(147): MediaWiki\Extension\OATHAuth\Special\OATHManage->hasSpecialModules()
#8 /srv/mediawiki/php-master/includes/specialpage/SpecialPage.php(711): MediaWiki\Extension\OATHAuth\Special\OATHManage->execute(null)
#9 /srv/mediawiki/php-master/includes/specialpage/SpecialPageFactory.php(1730): MediaWiki\SpecialPage\SpecialPage->run(null)
#10 /srv/mediawiki/php-master/includes/actions/ActionEntryPoint.php(499): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#11 /srv/mediawiki/php-master/includes/actions/ActionEntryPoint.php(143): MediaWiki\Actions\ActionEntryPoint->performRequest()
#12 /srv/mediawiki/php-master/includes/MediaWikiEntryPoint.php(184): MediaWiki\Actions\ActionEntryPoint->execute()
#13 /srv/mediawiki/php-master/index.php(44): MediaWiki\MediaWikiEntryPoint->run()
#14 /srv/mediawiki/w/index.php(3): require(string)
#15 {main}

The TOTP device does appear to have been created correctly: the DB entry looks correct and I can login with the TOTP device.

Steps to reproduce problem
  1. https://auth.wikimedia.beta.wmcloud.org/enwiki/w/index.php?title=Special%3AAccountSecurity&action=enable&module=totp
  2. Setup a TOTP device and submit the form
Environment

Wiki(s): https://en.wikipedia.beta.wmflabs.org OATHAuth – (fdde87f) 08:00, 9 October 2025. WebAuthn – (1957699) 20:10, 3 October 2025.

Event Timeline

Hmm, this must be a recent regression. Will look into this.

Change #1194952 had a related patch set uploaded (by SBassett; author: SBassett):

[mediawiki/extensions/OATHAuth@master] Reinstate null-coalesce to empty array when getting key data in session

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

Change #1194952 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Reinstate null-coalesce to empty array when getting key data in session

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

Change #1194960 had a related patch set uploaded (by SBassett; author: SBassett):

[mediawiki/extensions/OATHAuth@wmf/1.45.0-wmf.22] Reinstate null-coalesce to empty array when getting key data in session

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

Change #1194960 abandoned by SBassett:

[mediawiki/extensions/OATHAuth@wmf/1.45.0-wmf.22] Reinstate null-coalesce to empty array when getting key data in session

Reason:

Change squashed into https://gerrit.wikimedia.org/r/1194962

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

sbassett changed the task status from Open to In Progress.Oct 9 2025, 3:01 PM
sbassett claimed this task.
sbassett triaged this task as High priority.
Reedy moved this task from Backlog to Bugs on the MediaWiki-extensions-OATHAuth board.