Page MenuHomePhabricator

Error handling is set up too late to catch extension registration errors
Open, Needs TriagePublic


Steps to reproduce:

  1. install MediaWiki-Vagrant with some extension role enabled
  2. break the extension's extension.json file
  3. run some maintenance script

There will be an error like this on stdout:

1$ sudo --preserve-env -u www-data -n -- /usr/local/bin/mwscript sql.php
2PHP Fatal error: Uncaught exception 'Exception' with message '/vagrant/mediawiki/extensions/Wikispeech/extension.json is not a valid JSON file.' in /vagrant/mediawiki/includes/registration/ExtensionRegistry.php:212
3Stack trace:
4#0 /vagrant/mediawiki/includes/registration/ExtensionRegistry.php(148): ExtensionRegistry->readFromQueue(Array)
5#1 /vagrant/mediawiki/includes/Setup.php(40): ExtensionRegistry->loadFromQueue()
6#2 /vagrant/mediawiki/maintenance/doMaintenance.php(98): require_once('/vagrant/mediaw...')
7#3 /vagrant/mediawiki/maintenance/sql.php(192): require_once('/vagrant/mediaw...')
8#4 /var/www/w/MWScript.php(95): require_once('/vagrant/mediaw...')
9#5 {main}
10 thrown in /vagrant/mediawiki/includes/registration/ExtensionRegistry.php on line 212
12Fatal error: Uncaught exception 'Exception' with message '/vagrant/mediawiki/extensions/Wikispeech/extension.json is not a valid JSON file.' in /vagrant/mediawiki/includes/registration/ExtensionRegistry.php on line 212
14Exception: /vagrant/mediawiki/extensions/Wikispeech/extension.json is not a valid JSON file. in /vagrant/mediawiki/includes/registration/ExtensionRegistry.php on line 212
16Call Stack:
17 0.0002 239480 1. {main}() /var/www/w/MWScript.php:0
18 0.0021 331832 2. require_once('/vagrant/mediawiki/maintenance/sql.php') /var/www/w/MWScript.php:95
19 0.0043 749664 3. require_once('/vagrant/mediawiki/maintenance/doMaintenance.php') /vagrant/mediawiki/maintenance/sql.php:192
20 0.0313 4199544 4. require_once('/vagrant/mediawiki/includes/Setup.php') /vagrant/mediawiki/maintenance/doMaintenance.php:98
21 0.0326 4369072 5. ExtensionRegistry->loadFromQueue() /vagrant/mediawiki/includes/Setup.php:40
22 0.0382 5075312 6. ExtensionRegistry->readFromQueue() /vagrant/mediawiki/includes/registration/ExtensionRegistry.php:148
which will be logged absolutely nowhere (which is problematic when the maintenance script is is run by some background process or in any other way where stdout is not visible to the user).

On one hand, it's a good thing that extensions can modify error handling (actually they can't, see T153256; but it makes sense to allow extension registration first, to handle that use case). On the other hand, there should be *some* error handling in the early steps of startup.