Page MenuHomePhabricator

$wgNamespacesToBeSearchedDefault declaration throws error in v1.34
Closed, InvalidPublic

Description

I have several wikis for which I declare $wgNamespacesToBeSearchedDefault as follows:

	$wgNamespacesToBeSearchedDefault = array(
		NS_MAIN =>           true,
		NS_TALK =>           false,
		NS_USER =>           true,
		NS_USER_TALK =>      false,
		NS_PROJECT =>      	 false,
		NS_PROJECT_TALK =>   false,
		NS_IMAGE =>          true,
		NS_IMAGE_TALK =>     false,
		NS_MEDIAWIKI =>      false,
		NS_MEDIAWIKI_TALK => false,
		NS_TEMPLATE =>       true,
		NS_TEMPLATE_TALK =>  false,
		NS_HELP =>           false,
		NS_HELP_TALK =>      false,
		NS_CATEGORY =>       true,
		NS_CATEGORY_TALK =>  false
	); # for not-logged-in viewers}

After update to Mediawiki 1.34 the wiki works without errors on page, but I get the following errors in my php.log:

[21-Dec-2019 10:09:57 America/Winnipeg] PHP Warning:  Use of undefined constant NS_IMAGE - assumed 'NS_IMAGE' (this will throw an Error in a future version of PHP) in /home/xxx/wiki.xxx.ca/LocalSettings.php on line 98
[21-Dec-2019 10:09:57 America/Winnipeg] PHP Warning:  Use of undefined constant NS_IMAGE_TALK - assumed 'NS_IMAGE_TALK' (this will throw an Error in a future version of PHP) in /home/xxx/wiki.xxx.ca/LocalSettings.php on line 99

Declaration was not changed at update.
Versions:
MediaWiki: 1.34.0 (ff037a9)
Git branch: REL1_34
PHP: 7.3.11

Event Timeline

Sorry, I just searched phabricator for this now, and it looks like there have been some changes. Reading those now to see if this ticket will still be required.

Clean up to remove unneeded entries:
https://phabricator.wikimedia.org/rOMWC39236738f112c568111380616d230c6d8db4f429

https://phabricator.wikimedia.org/rGTWN66dd76e759b00f36cc0c13d047cc0c2205332549

They've been deprecated since 1.14 (pre 2010), and were removed. Use NS_FILE and NS_FILE_TALK instead

It's documented in https://github.com/wikimedia/mediawiki/blob/REL1_34/RELEASE-NOTES-1.34#L413-L414

Ah. We run an old wiki. Thanks, will fix that.

Ah. We run an old wiki. Thanks, will fix that.

You should be fine to use NS_FILE/NS_FILE_TALK there too for consistency