Page MenuHomePhabricator

Fatal error when $wgPhonosEngine is invalid
Closed, InvalidPublicBUG REPORT

Description

What is the problem?

If I set the config variable $wgPhonosEngine to something invalid (e.g. $wgPhonosEngine = "espeak";) I cannot load any page on the wiki and instead I get a fatal error:

MediaWiki internal error.

Original exception: [54f2b6a37d982e98a5255938] /wiki/Special:Version ConfigException: Invalid is not a valid engine
Backtrace:
from /var/www/html/w/extensions/Phonos/includes/ServiceWiring.php(14)
#0 /var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}()
#1 /var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService()
#2 /var/www/html/w/includes/MediaWikiServices.php(302): Wikimedia\Services\ServiceContainer->getService()
#3 /var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php(419): MediaWiki\MediaWikiServices->getService()
#4 /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php(211): Wikimedia\Services\ServiceContainer->get()
#5 /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php(152): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec()
#6 /var/www/html/w/includes/HookContainer/HookContainer.php(473): Wikimedia\ObjectFactory\ObjectFactory->createObject()
#7 /var/www/html/w/includes/HookContainer/HookContainer.php(156): MediaWiki\HookContainer\HookContainer->getHandlers()
#8 /var/www/html/w/includes/HookContainer/HookRunner.php(2923): MediaWiki\HookContainer\HookContainer->run()
#9 /var/www/html/w/includes/parser/Parser.php(549): MediaWiki\HookContainer\HookRunner->onParserFirstCallInit()
#10 /var/www/html/w/includes/parser/ParserFactory.php(216): Parser->__construct()
#11 /var/www/html/w/includes/parser/ParserFactory.php(233): ParserFactory->create()
#12 /var/www/html/w/includes/ServiceWiring.php(1268): ParserFactory->getMainInstance()
#13 /var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}()
#14 /var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService()
#15 /var/www/html/w/includes/MediaWikiServices.php(302): Wikimedia\Services\ServiceContainer->getService()
#16 /var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php(419): MediaWiki\MediaWikiServices->getService()
#17 /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php(211): Wikimedia\Services\ServiceContainer->get()
#18 /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php(152): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec()
#19 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(1290): Wikimedia\ObjectFactory\ObjectFactory->createObject()
#20 /var/www/html/w/includes/MediaWiki.php(275): MediaWiki\SpecialPage\SpecialPageFactory->getPage()
#21 /var/www/html/w/includes/MediaWiki.php(904): MediaWiki->performRequest()
#22 /var/www/html/w/includes/MediaWiki.php(562): MediaWiki->main()
#23 /var/www/html/w/index.php(50): MediaWiki->run()
#24 /var/www/html/w/index.php(46): wfIndexMain()
#25 {main}

We could handle invalid configurations more gracefully and without making the site inaccessible.

Steps to reproduce problem
  1. In LocalSettings.php, add $wgPhonosEngine = "invalid";
  2. Visit any page on the wiki

Expected behavior: The page loads. If the page has a Phonos template this should display an appropriate error when you try to play it.
Observed behavior: You see the above error.

Event Timeline

MusikAnimal subscribed.

I know you very carefully laid out all the scenarios and asked me to reply if they were correct at T316700#8255736, and I totally didn't... I promise I'll get better at that! :) To add to that, I should have noted this was expected in the acceptance criteria.

This error is not only expected but is intentional. This isn't something we're worried about as only a sysadmin can introduce this kind of error. The fatal exception is just there to tell them they did it wrong :)

If I set the config variable $wgPhonosEngine to something invalid (e.g. $wgPhonosEngine = "espeak";)

I'm assuming your example wasn't supposed to be espeak as that is valid.

Thanks for filing this anyway! Apologies again for being so slow to respond.