Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Upgrading from 1.6.03 to 1.6.19 for PHP 8.1  (Read 151 times)

0 Members and 1 Guest are viewing this topic.

Bobbywires

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Upgrading from 1.6.03 to 1.6.19 for PHP 8.1
« 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
Logged

Bobbywires

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Upgrading from 1.6.03 to 1.6.19 for PHP 8.1
« Reply #1 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);
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1811
Re: Upgrading from 1.6.03 to 1.6.19 for PHP 8.1
« Reply #2 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']}");
Logged
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 20 queries.