Page MenuHomePhabricator

TypeError thrown running php maintenance/update.php --quick --force
Open, Needs TriagePublicBUG REPORT

Description

Try running: php maintenance/update.php --quick --force with Flow and CentralAuth extensions installed.

[e02fe80e57668032e5ebfc00] [no req]   TypeError from line 184 of /usr/local/var/www/wiki/mw-core/extensions/CentralAuth/includes/CentralAuthUser.php: Argument 1 passed to CentralAuthUser::getMasterInstance() must be an instance of User, null given, called in /usr/local/var/www/wiki/mw-core/extensions/Flow/includes/TalkpageManager.php on line 254
Backtrace:
#0 /usr/local/var/www/wiki/mw-core/extensions/Flow/includes/TalkpageManager.php(254): CentralAuthUser::getMasterInstance(NULL)
#1 /usr/local/var/www/wiki/mw-core/extensions/Flow/maintenance/FlowCreateTemplates.php(114): Flow\TalkpageManager->getTalkpageManager()
#2 /usr/local/var/www/wiki/mw-core/extensions/Flow/maintenance/FlowCreateTemplates.php(86): FlowCreateTemplates->create(Title, WikitextContent)
#3 /usr/local/var/www/wiki/mw-core/maintenance/Maintenance.php(1730): FlowCreateTemplates->doDBUpdates()
#4 /usr/local/var/www/wiki/mw-core/maintenance/update.php(221): LoggedUpdateMaintenance->execute()
#5 /usr/local/var/www/wiki/mw-core/maintenance/doMaintenance.php(99): UpdateMediaWiki->execute()
#6 /usr/local/var/www/wiki/mw-core/maintenance/update.php(281): require_once(string)
#7 {main}
Notes

MediaWiki 1.34-alpha
PHP: 7.3.8

The issue is this piece of code;

$user = User::newSystemUser( FLOW_TALK_PAGE_MANAGER_USER, [ 'steal' => true ] );

because User::newSystemUser() can return null but CentralAuthUser::getMasterInstance() expects strictly only a User object.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
xSavitar renamed this task from Error thrown running php maintenance/update.php --quick --force to TypeError thrown running php maintenance/update.php --quick --force.Aug 27 2019, 3:07 PM
xSavitar updated the task description. (Show Details)
kostajh changed the subtype of this task from "Task" to "Bug Report".Aug 28 2019, 7:28 AM

Change 532970 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/Flow@master] Ensure user is not null before passing to CentralAuth

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

kostajh subscribed.

I can't reproduce this, but I have a patch which ensures $user is not null before passing it on to CentralAuth.

I can't reproduce it and I don't see notices of the problem in Logstash. I'll leave this for anyone who wants to investigate it further, I think the resolution would be to throw a more clearly worded exception when this occurs.

Change 532970 abandoned by Kosta Harlan:
Ensure user is not null before passing to CentralAuth

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