Advertisement:

Author Topic: Load.php error  (Read 371 times)

Offline Dave J

  • Full Member
  • ***
  • Posts: 410
    • The Hobby Workshop
Load.php error
« on: January 22, 2021, 06:52:09 AM »
Hi All

I'm using SMF 2.0.17 with PHP 7.0

The error is

Code: [Select]
https://www.davejohnson.co.uk/index.php?action=admin;area=logs;sa=errorlog;desc
8: Trying to access array offset on value of type null
File: /******/********/public_html/Sources/Load.php
Line: 192

=>192: $utf8 = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8' && (strpos(strtolower(PHP_OS), 'win') === false || @version_compare(PHP_VERSION, '4.2.3') != -1);

I have not set the database to UTF-8.

Not sure if these are related but if you look at the attachment below the 'Error Log' reports there are 2 errors but the list only shows 1.

It doesn't matter how many errors there are it always says there 1 more than there is.

Can you help please?
« Last Edit: January 22, 2021, 07:39:39 AM by Dave J »

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 124
Re: Load.php error
« Reply #1 on: January 22, 2021, 08:28:57 AM »
I assume that either: $modSettings['global_character_set'] or $txt['lang_character_set'] are null in this case.

Optionally, to figure out which one, you could check if the two arrays are null prior to that call (remember to backup the file first).
Code: [Select]
// add before line 192 in Load.php
if (is_null($txt['lang_character_set'])){
 trigger_error("$txt is null", E_USER_WARNING);
} elseif (is_null($modSettings['global_character_set'])){
 trigger_error("$modSettings is null", E_USER_WARNING);
}

Reload the page, post back the results and we can go from there. I am going to assume it will be an issue with $modSettings.

Offline Dave J

  • Full Member
  • ***
  • Posts: 410
    • The Hobby Workshop
Re: Load.php error
« Reply #2 on: January 22, 2021, 09:20:11 AM »
Ok did that now there are 3 errors, see attachment

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 124
Re: Load.php error
« Reply #3 on: January 22, 2021, 09:47:59 AM »
Apologies, it is rendering the variable, change to:

Code: [Select]
// add before line 192 in Load.php
if (is_null($txt['lang_character_set'])){
 trigger_error("txt is null", E_USER_WARNING);
} elseif (is_null($modSettings['global_character_set'])){
 trigger_error("modSettings is null", E_USER_WARNING);
}

From the looks of it however, it is going to be $txt['lang_character_set'] that is null, but make that change and reload to confirm

Offline Dave J

  • Full Member
  • ***
  • Posts: 410
    • The Hobby Workshop
Re: Load.php error
« Reply #4 on: January 22, 2021, 10:32:36 AM »
These are the errors

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,819
  • We were all equal in the end.
Re: Load.php error
« Reply #5 on: January 22, 2021, 12:03:07 PM »
Clear forum cache.
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Offline Dave J

  • Full Member
  • ***
  • Posts: 410
    • The Hobby Workshop
Re: Load.php error
« Reply #6 on: January 22, 2021, 12:18:21 PM »
Clear forum cache.

That makes no difference.

Emptied in maintenance and via ftp

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,819
  • We were all equal in the end.
Re: Load.php error
« Reply #7 on: January 22, 2021, 12:22:04 PM »
Did you change something just before error appeared?
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Offline Dave J

  • Full Member
  • ***
  • Posts: 410
    • The Hobby Workshop
Re: Load.php error
« Reply #8 on: January 22, 2021, 12:31:29 PM »
Did you change something just before error appeared?

No I didn't but I have just checked the PHP version and the host changed me to PHP 74 the .htaccess file said I was still on php70

So I have just changed it back to PHP 71 and the error has now gone

Thanks guys for the replies it's much appreciated.

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,819
  • We were all equal in the end.
Re: Load.php error
« Reply #9 on: January 22, 2021, 12:34:17 PM »
2.0.17 supports up to php 7.3.  Your forum looked to be running ok in 7.4, but will log a lot of errors.  My forums are running in 7.2.
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns