Page MenuHomePhabricator

Internal error loading Special:Preferences if "skin" is added to $wgHiddenPrefs
Open, MediumPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Edit LocalSettings.php and add this line:
$wgHiddenPrefs[] = 'skin';
  • Attempt to load Special:Preferences on the wiki

What happens?:

[1d761ffcb8bc12368a36a68e] /index.php/Special:Preferences DomainException: HTMLForm::getField: no field named skin

Backtrace:

from /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLForm.php(459)
#0 /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLFormField.php(150): HTMLForm->getField(string)
#1 /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLFormField.php(165): HTMLFormField->getNearestField(string, boolean)
#2 /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLFormField.php(281): HTMLFormField->getNearestFieldValue(array, string, boolean, boolean)
#3 /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLFormField.php(269): HTMLFormField->checkStateRecurse(array, array)
#4 /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLFormField.php(350): HTMLFormField->checkStateRecurse(array, array)
#5 /Users/jayden/Documents/Dev/mediawiki-dev/includes/htmlform/HTMLFormField.php(401): HTMLFormField->isHidden(array)
#6 /Users/jayden/Documents/Dev/mediawiki-dev/includes/preferences/DefaultPreferencesFactory.php(348): HTMLFormField->validate(integer, array)
#7 /Users/jayden/Documents/Dev/mediawiki-dev/includes/preferences/DefaultPreferencesFactory.php(263): MediaWiki\Preferences\DefaultPreferencesFactory->loadPreferenceValues(User, RequestContext, array)
#8 /Users/jayden/Documents/Dev/mediawiki-dev/includes/preferences/DefaultPreferencesFactory.php(1841): MediaWiki\Preferences\DefaultPreferencesFactory->getFormDescriptor(User, RequestContext)
#9 /Users/jayden/Documents/Dev/mediawiki-dev/includes/specials/SpecialPreferences.php(142): MediaWiki\Preferences\DefaultPreferencesFactory->getForm(User, RequestContext, string)
#10 /Users/jayden/Documents/Dev/mediawiki-dev/includes/specials/SpecialPreferences.php(109): SpecialPreferences->getFormObject(User, RequestContext)
#11 /Users/jayden/Documents/Dev/mediawiki-dev/includes/specialpage/SpecialPage.php(701): SpecialPreferences->execute(NULL)
#12 /Users/jayden/Documents/Dev/mediawiki-dev/includes/specialpage/SpecialPageFactory.php(1563): SpecialPage->run(NULL)
#13 /Users/jayden/Documents/Dev/mediawiki-dev/includes/MediaWiki.php(328): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#14 /Users/jayden/Documents/Dev/mediawiki-dev/includes/MediaWiki.php(927): MediaWiki->performRequest()
#15 /Users/jayden/Documents/Dev/mediawiki-dev/includes/MediaWiki.php(581): MediaWiki->main()
#16 /Users/jayden/Documents/Dev/mediawiki-dev/index.php(50): MediaWiki->run()
#17 /Users/jayden/Documents/Dev/mediawiki-dev/index.php(46): wfIndexMain()
#18 {main}

What should have happened instead?:

Special:Preferences should load successfully.

Software version (skip for WMF-hosted wikis like Wikipedia): 1.41.0-alpha (6bd00c6)

Other information (browser name/version, screenshots, etc.):

I have also reproduced this on MediaWiki 1.40. It doesn't appear to occur on MediaWiki 1.39. Disabling this configuration option is common on external wiki [farms], so this is a real annoyance. It is also a recommended approach to disabling user's abilities to change skins on Manual:Skin configuration on MediaWiki.org.

Event Timeline

$wgHiddenPrefs[] = 'skin'; seems very broken, other skins would still register their features and preferences if they are not uninstalled.
How skins are managed in your setup? Are there any difficulties with simply only install the wanted skin and not using $wgHiddenPrefs?

$wgHiddenPrefs[] = 'skin'; seems very broken, other skins would still register their features and preferences if they are not uninstalled.
How skins are managed in your setup? Are there any difficulties with simply only install the wanted skin and not using $wgHiddenPrefs?

We run runescape.wiki and other gaming wikis, where we use a heavily customised (via on-wiki CSS) version of legacy Vector (2010), with no current plans to upgrade to Vector (2022). If we don't hide the skin preferences, users are able to switch to that version of Vector (which looks terrible without our custom CSS) and to MinervaNeue, which is only intended to be available as a mobile skin used in conjunction with MobileFrontend, and not something that users should be able to switch their permanent preference to.

Not being able to hide the skin preferences is not tenable for us.

@JaydenKieran For the given case, $wgSkipSkins can be used for now, this should work for you:

$wgSkipSkins = [ 'vector-2022', 'minerva' ];

There will be an unfunctional "responsive mode" preference though.

Note this was working before and I will fix it.

@JaydenKieran For the given case, $wgSkipSkins can be used for now, this should work for you:

$wgSkipSkins = [ 'vector-2022', 'minerva' ];

That only hides it from the UI, it does not prevent using the skin otherwise. $wgHiddenPrefs is what does that correctly here.

Change 937598 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] preferences: Avoid referencing the hidden skin preference

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

Change 937599 had a related patch set uploaded (by Func; author: Func):

[mediawiki/skins/Vector@master] Hooks: Avoid referencing the hidden skin preference

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

Note this was working before and I will fix it.

Hope you haven't spent too much time on it, I have done some work on this these days, and I just noticed that you have claimed this task.

Patches on the core and Vector are ready for review.

Is there any interest in backporting the fix for this issue to 1.40 once reviewed & merged? I'm not sure if there's a formal process for requesting that, but it is seemingly likely to cause issues on more external MediaWiki installations than just ours.

Change 939245 had a related patch set uploaded (by Ammarpad; author: Ammarpad):

[mediawiki/core@master] preferences: restore ability to disable arbitrary pref completely

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

Change 939245 abandoned by Ammarpad:

[mediawiki/core@master] preferences: restore ability to disable arbitrary pref completely

Reason:

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

Ammarpad subscribed.

Given the hide-if logic is heavily dependent on skins it feels a little risky to support it being a hidden preference.

As an alternative approach could we simply use a hide-if statement for skins if only one skin is visible in preferences?
That seems like it would be cleaner and require less code than the approach proposed in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/937598

For the use case configuration would look like this:

$wgDefaultSkin = 'vector';
$wgSkipSkins = ['vector-2022'];