$wgMathValidModes appears in the documentation for Extension:Math and is shown as still being active as of version 1.43.1. But when I modify $wgMathValidModes in LocalSettings.php (for example $wgMathValidModes = ['native']), there is no effect. Special:MathStatus shows three options: LaTeX source, MathML, Client side MathJax rendering. Special:Preferences Appearance→Math shows the same three options (with MathML being selected by default).
The three options correspond to the setting of "MathValidModes" in extension.json. If I edit extension.json directly, then the change takes effect: removing an element removes the corresponding element from Special:MathStatus and Special:Preferences. (Except for "source", which may be special-cased.)
The Extension:Math source code currently in the REL1_43 branch does not reference $wgMathValidModes in code, only in text files or comments:
mediawiki/extensions/Math$ git log -1 --format=oneline fdb260a97c06954f065e0ed422f095509eafabb3 (HEAD, origin/REL1_43) Localisation updates from https://translatewiki.net. mediawiki/extensions/Math$ git grep wgMathValidModes HISTORY:* $wgMathValidModes is introduced: HISTORY:* $wgUseLaTeXML becomes unnecessary use $wgMathValidModes[] = 'latexml'; src/MathRenderer.php: * @param string $newMode element of the array $wgMathValidModes
A relevant recent change seems to be rEMAT363abd4afbe93aa4e85105c4b254063afede36ec, which changed all setMwGlobals( 'wgMathValidModes', ... ) to overrideConfigValue( 'MathValidModes', ... ).
I found T242919 from 2020 which seems to be the same problem, but it was closed on 2024-11-04 without references to any changes.
https://www.mediawiki.org/wiki/Topic:W6b1ivdmdl0mb7ov from 2021 seems to be about something similar in 1.35.1:
$wgMathValidModes does not forbid user or server to use the excluded options. I tested only on Mediawiki 1.35.1. For example, the below LocalSettings.php allows user to use 'source' or 'png':
wfLoadExtension( 'Math' ); $wgMathValidModes[] = 'mathml'; $wgDefaultUserOptions['math'] = 'mathml';Same here. 1.35.x appears to ignore the settings to the configuration parameter.
I suspect this is generally related to T271001.
I didn't check thoroughly, but the same thing may affect $wgMathUseInternalRestbasePath and other settings.
Steps to replicate the issue:
- In LocalSettings.php, add:
wfLoadExtension("Math");
$wgMathValidModes = ['source'];- Go to Special:MathStatus and Special:Preferences (Appearance tab).
What happens?:
See three options:
- LaTeX source
- MathML
- Client side MathJax rendering
What should have happened instead?:
See one option:
- LaTeX source
Software version:
| Product | Version |
|---|---|
| MediaWiki | 1.43.1 |
| PHP | 8.2.28 (fpm-fcgi) |
| ICU | 72.1 |
| SQLite | 3.40.1 |