Steps to replicate the issue (include links if applicable):
- Define a "config" variable Foo with an integer value in extension.js
- Reference that variable as $wgFoo, expecting it to be an integer
- But $wgFoo is an array
Example extension.json file:
{ "name": "FooExtension", "version": "2.0.0", "author": [ "Me" ], "description": "Do something", "license-name": "GPL-2.0-or-later", "type": "other", "AutoloadClasses": { "FooExtension": "includes/FooExtensionHooks.php" }, "config": { "FooExtensionTimeoutSeconds": { "value": 10, "description": "Set the timeout in seconds" }, "FooExtensionAnother": { "value": true, "description": "Something else" } }, "Hooks": { "BeforeInitialize": "FooExtension::onBeforeInitialize", "EditPage::showEditForm:initial": "FooExtension::onEditPageShowEditFormInitial", "MultiContentSave": "FooExtension::onMultiContentSave" }, "manifest_version": 1 }
What happens?:
When I refer to $wgFoo numerically in a hook function, like if (20 > $wgFoo), the comparison returns 0 even though $wgFoo is 10. On examination with gettype(), the variable $wgFoo is an array. I have to refer to the value as $wgFoo['value'] instead. The same comparison worked in MediaWiki 1.37. I just upgraded to 1.39 and upgraded PHP from 7.4 to 8.1, and this new behavior began.
What should have happened instead?:
$wgFoo is an integer.
Software version (skip for WMF-hosted wikis like Wikipedia):
Other information (browser name/version, screenshots, etc.):