Page MenuHomePhabricator

Config validator absurd warning: Array value found, but an array is required
Closed, ResolvedPublicBUG REPORT

Description

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

What happens?:

Some of your configuration settings caused a warning:

* Invalid MediaWiki configuration parameter "DnsBlacklistUrls": Array value
  found, but an array is required

Please correct the issue before running update.php again.
If you know what you are doing, you can bypass this check
using --skip-config-validation.

What should have happened instead?: Just run smoothly.

Software version (skip for WMF-hosted wikis like Wikipedia): 1.39.0-rc.1

Other information (browser name/version, screenshots, etc.):
I just testing php8 with mediawiki 1.39 rc.1

Details

Event Timeline

So I checked my email and it seems like i need to add this tag as I tested on 1.39

I'm not sure this should be a blocker

Ah well, let's keep it and let others decide. Sorry for the noise

Note: User Bawolff on Medawiki Wiki deleted the section I mentioned on this issue. Hmm?

https://www.mediawiki.org/w/index.php?title=Manual%3A%24wgDnsBlacklistUrls&type=revision&diff=5595037&oldid=5119014

Probably because it was out of date/no longer correct?

I have the same issue:

* Invalid MediaWiki configuration parameter "UrlProtocols": Array value found, but an array is required

Can be reproduced with the following code:

foreach ( $wgUrlProtocols as $index => $value ) {
	if ( $value === 'sms:' ) {
		unset( $wgUrlProtocols[ $index ] );
	}
}

The validator seems to choke on array vs list (array with numeric keys) causing this super confusing warning message.

Nikerabbit renamed this task from Some typecheck on $wgDnsBlacklistUrls causes update.php error. to Config validator absurd warning: Array value found, but an array is required.Apr 8 2023, 7:29 AM

I have this too, with $wgProhibitedFileExtensions. It happened after upgrading from MediaWiki 1.39.10 to 1.39.11. It had not happened during any prior upgrade in the 1.39 series. I am using PHP 7.4.33.

$ php maintenance/update.php
Some of your configuration settings caused a warning:

* Invalid MediaWiki configuration parameter "ProhibitedFileExtensions": Array
  value found, but an array is required

Please correct the issue before running update.php again.
If you know what you are doing, you can bypass this check
using --skip-config-validation.

I'm using the array_diff technique documented in the manual:

$wgProhibitedFileExtensions = array_diff($wgProhibitedFileExtensions, [ "pl" ]);

I worked around it for the upgrade by commenting out that line in LocalSettings.php, running update.php, and uncommenting the line again.

This vaguely ends up upstream - https://github.com/jsonrainbow/json-schema/issues/523

as the problem is caused by using the $associative = true when calling json_decode which should not be done as you are actually manipulating the JSON.

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

[mediawiki/core@master] config schema: Improve validation for array types

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

Change #1106210 merged by jenkins-bot:

[mediawiki/core@master] config schema: Improve validation for array types

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