Topic on Project:Support desk

[RESOLVED] Special:Upload - Argument #2 is not an array

3
Iantresman (talkcontribs)

I've just upgraded by Mediawiki from v1.6.1 to v1.23.5, running under PHP v5.4.25. MW runs in my root directory. On visiting the Special:Upload page, I originally saw a blank screen, but on enabling error reporting, I see the following error message:

Warning: array_diff(): Argument #2 is not an array in /path/root-direct/includes/Setup.php on line 362
Warning: array_values() expects parameter 1 to be array, null given in /path/root-direct/includes/Setup.php on line 362
Warning: array_unique() expects parameter 1 to be array, null given in /path/root-direct/includes/specials/SpecialUpload.php on line 919
Catchable fatal error: Argument 1 passed to Language::commaList() must be of the type array, null given, called in ..
   /path/root-direct/includes/specials/SpecialUpload.php on line 919 and defined in /path/root-direct/languages/Language.php on line 3266
  • Now that I have errors enabled, I see that the first two warnings (to Setup.php on line 362) appear on every page, so I guess that the Catchable fatal error is causing the problems with Special:Upload

In my LocalSettings.php file, I do not have either $wgFileExtensions, nor $wgFileBlacklist, defined.

includes/Setup.php on line 362

$wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );

/specials/SpecialUpload.php on line 919

$this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions ) )

languages/Language.php on line 3266+

function commaList( array $list ) {
	return implode(
		wfMessage( 'comma-separator' )->inLanguage( $this )->escaped(),
		$list
	);
}
Ciencia Al Poder (talkcontribs)

All variables are defined in DefaultSettings.php. In LocalSettings.php you override them when applicable. If you don't have them in LocalSettings.php, they'll have the default value

I guess somewhere in your code you have $wgFileBlacklist set to null. Try to grep the code to see if you can find where $wgFileBlacklist is set to null.

Maybe it's some of your extensions. Try disabling them.

Iantresman (talkcontribs)

Solved. Thanks for the heads up. I discovered the line "$wgFileBlacklist = true" in my LocalSettings.php file, which must have been lurking there without problems, since WM 1.6. Commenting it out resolved the issue. Of course $wgFileBlacklist should never take the value "true".

Reply to "[RESOLVED] Special:Upload - Argument #2 is not an array"