Page MenuHomePhabricator

Fatal error when maintenance script outputs help
Closed, ResolvedPublic

Description

Try, for instance, php maintenance/resetUserEmail.php without specifying the require parameters user and email. This is what you get:

Argument <user> required!
Argument <email> required!
PHP Fatal error:  Uncaught Error: Class 'MediaWiki\MediaWikiServices' not found in /var/www/html/maintenance/Maintenance.php:385
Stack trace:
#0 /var/www/html/maintenance/Maintenance.php(998): Maintenance->output('\nResets a user'...')
#1 /var/www/html/maintenance/Maintenance.php(958): Maintenance->maybeHelp(true)
#2 /var/www/html/maintenance/Maintenance.php(720): Maintenance->validateParamsAndArgs()
#3 /var/www/html/maintenance/doMaintenance.php(51): Maintenance->setup()
#4 /var/www/html/maintenance/resetUserEmail.php(72): require_once('/var/www/html/m...')
#5 {main}
  thrown in /var/www/html/maintenance/Maintenance.php on line 385

Only the first two lines should have been returned. The fatal is concerning.

Event Timeline

Seb35 renamed this task from Fatal error when maintenance script parameters are not provided to Fatal error when maintenance script outputs help.Jan 13 2018, 8:58 PM

I also experienced this issue recently with MediaWiki 1.31 (not 1.30), with all maintenance scripts with the parameter "-h" to display help, e.g. "php maintenance/runJobs.php -h".

Seb35 assigned this task to hoo.
Seb35 added a subscriber: hoo.

It was fixed in rMW803a291 on January 5, 2018. Thanks @hoo!