Page MenuHomePhabricator

Special:Preferences "Global default '' is invalid for field theme" MWException on 1.30 RC
Closed, ResolvedPublic

Description

When trying to access Special:Preferences after updating to the release candidate of 1.30, I am getting a MW exception. Tagging as high priority as it seems important.

Version: 1.30 RC
PHP: 5.6

2017-12-02 19:03:45 test1 test1wiki: [e74b9347da1dfd50d354570f] /wiki/Special:Preferences   MWException from line 148 of /srv/mediawiki/w/includes/Preferences.php: Global default '' is invalid for field theme
#0 /srv/mediawiki/w/includes/Preferences.php(100): Preferences::loadPreferenceValues(User, RequestContext, array)
#1 /srv/mediawiki/w/includes/Preferences.php(1356): Preferences::getPreferences(User, RequestContext)
#2 /srv/mediawiki/w/includes/specials/SpecialPreferences.php(127): Preferences::getFormObject(User, RequestContext)
#3 /srv/mediawiki/w/includes/specials/SpecialPreferences.php(84): SpecialPreferences->getFormObject(User, RequestContext)
#4 /srv/mediawiki/w/includes/specialpage/SpecialPage.php(522): SpecialPreferences->execute(NULL)
#5 /srv/mediawiki/w/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
#6 /srv/mediawiki/w/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#7 /srv/mediawiki/w/includes/MediaWiki.php(851): MediaWiki->performRequest()
#8 /srv/mediawiki/w/includes/MediaWiki.php(523): MediaWiki->main()
#9 /srv/mediawiki/w/index.php(43): MediaWiki->run()
#10 {main}

When loading Special:Preferences

should-be-able-to-change-preferences.png (894×1 px, 125 KB)

Event Timeline

Reception123 renamed this task from MWException on 1.30 RC to Special:Preferences "Global default '' is invalid for field theme" MWException on 1.30 RC .Dec 2 2017, 7:13 PM

After a quick check I guess this is an issue with the Theme @ a12ec18 extension used on Miraheze.

https://github.com/wikimedia/mediawiki-extensions-Theme/blob/a12ec181eca26356c3e70ceb798debeff8b5bec5/Theme.hooks.php#L101

It could be that the extension is meant to add the default to using the hook UserGetDefaultOptions as well?
Or it could be some issue with localization as the default linked is a message.

Reception123 raised the priority of this task from High to Needs Triage.Dec 2 2017, 7:45 PM
Reception123 edited projects, added Theme; removed MW-1.30-release.

Per @Addshore's comment, no longer dependent of release/etc.

This comment was removed by Aklapper.

Is $wgDefaultTheme defined properly in the site's configuration file? The extension intentionally does not set it in its extension.json file, so if it's not defined, I could see the error happening. (The Theme extension is installed on the social tools testing wiki, running MW 1.29.)

Thanks @ashley for your comment above.

I've had a look at my own wiki running MW 1.31-rc and without $wgDefaultTheme set I receive this error when going to preferences.

It is resolved if this variable is set in LocalSettings.php, e.g. $wgDefaultTheme = 'blue';

  • Is the only action required making a note on Extension:Theme that this is required?
  • Should it be automatically set by the extension? Preferences must not break with default extension settings I might have thought.

It is resolved if this variable is set in LocalSettings.php, e.g. $wgDefaultTheme = 'blue';

If there isn't such a theme, you'll want to set it to default instead as default is a special value for which there is special handling in the extension. All other strings are assumed to be valid theme names.

  • Is the only action required making a note on Extension:Theme that this is required?

Seems reasonable, yeah.

  • Should it be automatically set by the extension? Preferences must not break with default extension settings I might have thought.

In an ideal world, yes. However, I'm not sure how that would impact ShoutWiki's setup, but we may look into that soon as MediaWiki 1.31 is released and we being updating ShoutWiki to that version.

cc'ing @SamanthaNguyen for additional thoughts on this

It is not acceptable to have an extension to cause Special:Preferences to throw an error :]

Change 437753 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/extensions/Theme@master] Ensure $wgDefaultTheme has a sane value

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

Change 437753 merged by jenkins-bot:
[mediawiki/extensions/Theme@master] Ensure $wgDefaultTheme has a sane value

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

hashar claimed this task.