Yes its fine to use long array syntax.
Are the error messages suggesting that the syntax is wrong?
-- Brian
On Monday, February 13, 2023, rogerchrisman@gmail.com wrote:
Hello,
I have some array declarations in my LocalSettings.php from many years ago that I am worried may not be compatible with PHP 8+. When I try to run /maintenance/update.php in PHP 8.1 I get errors. It runs fine in PHP 7.4.3, fortunately. However, is it okay to set arrays like this in PHP 8+?:
$wgSitemapNamespaces = array( 0, 100, 102 );
Thank you :)
Roger teflpedia.com <- MediaWiki 1.39.1 recently upgraded
-----example from my LocalSettings.php-----
# Site Map see https://www.mediawiki.org/wiki/Manual:$wgSitemapNamespaces #$wgSitemapNamespaces = array( 0, 2, 4, 12 ); # example, to site map Main-0, User-2, Project-4, Help-12 namespace $wgSitemapNamespaces = array( 0, 100, 102 ); # let's site map ONLY Main, Essay, Lesson namespace
## Extra namespaces $wgExtraNamespaces[100] = "Lesson"; $wgExtraNamespaces[101] = "Lesson_talk"; $wgExtraNamespaces[102] = "Essay"; $wgExtraNamespaces[103] = "Essay_talk"; $wgExtraNamespaces[104] = "Debate"; $wgExtraNamespaces[105] = "Debate_talk";
## Enable subpages in all namespaces $wgNamespacesWithSubpages = array_fill(0, 200, true); $wgNamespacesWithSubpages[NS_MAIN] = false; # per Duncan request Jan 11, 2022
## Set default searching. Roger 2012.11.03, updated array syntax 2023.02.13 $wgNamespacesToBeSearchedDefault = [ NS_MAIN => true, NS_TALK => false, NS_USER => false, NS_USER_TALK => false, NS_PROJECT => false, NS_PROJECT_TALK => false, NS_IMAGE => false, NS_IMAGE_TALK => false, NS_MEDIAWIKI => false, NS_MEDIAWIKI_TALK => false, NS_TEMPLATE => false, NS_TEMPLATE_TALK => false, NS_HELP => false, NS_HELP_TALK => false, NS_CATEGORY => false, NS_CATEGORY_TALK => false, 100 => true, 101 => false ];
-------/example--------