Thank you for your replies! It does me tons of good to have your help. So, no worries about my array syntax. That is a relief. I don't know computer programming. I'm one of the simple minded people. So I upgrade the wiki only on LTR dates. Thank you for your help!

I get this error when I run the update.php, in either PHP 8.0 or PHP 8.1:

bilbo@cpanel84:~/www/teflpedia/maintenance$ php update.php
Fatal error: Uncaught Error: Undefined constant "NS_IMAGE" in /home/bilbo/public_html/teflpedia/LocalSettings.php:309
Stack trace:
#0 /home/bilbo/public_html/teflpedia/includes/Setup.php(218): require_once()
#1 /home/bilbo/public_html/teflpedia/maintenance/doMaintenance.php(83): require_once('/home/bilbo/pub...')
#2 /home/bilbo/public_html/teflpedia/maintenance/update.php(312): require_once('/home/bilbo/pub...')
#3 {main}
  thrown in /home/bilbo/public_html/teflpedia/LocalSettings.php on line 309
bilbo@cpanel84:~/www/teflpedia/maintenance$

The update.php runs without errors, thankfully, in PHP 7.4.3. Why is that?

I recently upgraded this wiki from MediaWiki 1.35.1 to MediaWiki 1.39.1. The wiki is over a decade old and uses short URLs which I prefer. I will run it in PHP 7.4.3 for now, right?

Is there anything I should do?

Roger
Teflpedia.com








On Mon, Feb 13, 2023 at 10:15 PM Brian Wolff <bawolff@gmail.com> wrote:
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-----

#$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--------

_______________________________________________
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org
To unsubscribe send an email to mediawiki-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/