forum.coppermine-gallery.net

Support => cpg1.6.x Support => cpg1.6 upgrading => Topic started by: Bobbywires on May 09, 2022, 11:06:26 pm

Title: Upgrading from 1.6.03 to 1.6.19 for PHP 8.1
Post by: Bobbywires on May 09, 2022, 11:06:26 pm
Upgrade runs in 7.3 versioncheck passes but switching to 8.1   I get the following errors:

Fatal error: Uncaught TypeError: ksort(): Argument #1 ($array) must be of type array, null given in /home/bobby0/public_html/stockdale7/include/functions.inc.php:4270 Stack trace: #0 /home/bobby0/public_html/stockdale7/include/functions.inc.php(4270): ksort() #1 /home/bobby0/public_html/stockdale7/include/functions.inc.php(896): languageSelect() #2 /home/bobby0/public_html/stockdale7/include/init.inc.php(442): load_template() #3 /home/bobby0/public_html/stockdale7/index.php(22): require('/home/bobby0/pu...') #4 {main} thrown in /home/bobby0/public_html/stockdale7/include/functions.inc.php on line 4270
Title: Re: Upgrading from 1.6.03 to 1.6.19 for PHP 8.1
Post by: Bobbywires on May 09, 2022, 11:28:19 pm
Here is the code
   // get list of available languages
    $results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_LANGUAGE']}");
    while ( ($row = $results->fetchArray()) ) {
        if ($row['available'] == 'YES' && $row['enabled'] == 'YES' && file_exists('lang/'.$row['lang_id'].'.php')) {
            $lang_language_data[$row['lang_id']] = $row;
        }
    } // while
    $results->free();

    // sort the array by English name
    ksort($lang_language_data);
Title: Re: Upgrading from 1.6.03 to 1.6.19 for PHP 8.1
Post by: ron4mac on May 10, 2022, 12:18:34 am
Add the line:

Code: [Select]
    $lang_language_data = [];        // <--- add this
    // get list of available languages
    $results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_LANGUAGE']}");