Page MenuHomePhabricator

Warnings in install.php when Math is loaded
Open, Needs TriagePublic

Description

When running install.php with the Math extension I got the following warnings in the install.php output.

The install went fine (I think) but these warnings shouldn't be here.

These line numbers relate to REL1_35

Creating tables for enabled extensions
Warning: array_map(): Expected parameter 2 to be an array, null given in /var/www/html/w/extensions/Math/src/MathRenderer.php on line 699
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/w/extensions/Math/src/MathHooks.php on line 305
Warning: array_map(): Expected parameter 2 to be an array, null given in /var/www/html/w/extensions/Math/src/MathRenderer.php on line 699
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/w/extensions/Math/src/MathHooks.php on line 317
Creating account_requests table ...done.

Event Timeline

mathModeToString is array_map'ed on $wgMathValidModes. By default that's an array. How would it stop being one?

Is your LocalSettings or whatever setting it to a string by mistake?

The localsettings of the install this is concerned with does not set wgMathValidModes at all :/
The setup is currently using 1.33, but that looks to have the default correctly set too https://github.com/wikimedia/mediawiki-extensions-Math/blob/REL1_33/extension.json#L114-L118

I think this might have something to do with running install.php for the first time, with the added installation of extensions.
My hunch would be that the settings are not evaluated from extension.json and created as globals in this situation?

It could be that changing getValidModes to use a config object from mediawiki services instead of a global might fix that?
I havn't dug into this newer installer + extensions much yet, but I think there is still something to fix here.

Also in 1.34

Creating tables for enabled extensions
Warning: array_map(): Expected parameter 2 to be an array, null given in /var/www/html/w/extensions/Math/src/MathRenderer.php on line 696
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/w/extensions/Math/src/MathHooks.php on line 305
Warning: array_map(): Expected parameter 2 to be an array, null given in /var/www/html/w/extensions/Math/src/MathRenderer.php on line 696
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/w/extensions/Math/src/MathHooks.php on line 317
Creating account_requests table ...done.

And 1.35

Creating tables for enabled extensions
Warning: array_map(): Expected parameter 2 to be an array, null given in /var/www/html/w/extensions/Math/src/MathRenderer.php on line 699
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/w/extensions/Math/src/MathHooks.php on line 305
Warning: array_map(): Expected parameter 2 to be an array, null given in /var/www/html/w/extensions/Math/src/MathRenderer.php on line 699
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/w/extensions/Math/src/MathHooks.php on line 317
Creating account_requests table ...done.

I'm noticing this happening in 1.36.1:

<br />
<b>Warning</b>:  array_map(): Expected parameter 2 to be an array, null given in <b>/mnt/wiki-gfs/test.limswiki.org/extensions/Math/src/MathRenderer.php</b> on line <b>722</b><br />
<br />
<b>Warning</b>:  in_array() expects parameter 2 to be array, null given in <b>/mnt/wiki-gfs/test.limswiki.org/extensions/Math/src/Hooks.php</b> on line <b>315</b><br />
<br />
<b>Warning</b>:  array_map(): Expected parameter 2 to be an array, null given in <b>/mnt/wiki-gfs/test.limswiki.org/extensions/Math/src/MathRenderer.php</b> on line <b>722</b><br />
<br />
<b>Warning</b>:  in_array() expects parameter 2 to be array, null given in <b>/mnt/wiki-gfs/test.limswiki.org/extensions/Math/src/Hooks.php</b> on line <b>327</b><br />