News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Load.php error

Started by Dave J, January 22, 2021, 06:52:09 AM

Previous topic - Next topic

Dave J

Hi All

I'm using SMF 2.0.17 with PHP 7.0

The error is

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?
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

tjbalon

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).

// 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.

Dave J

Ok did that now there are 3 errors, see attachment
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

tjbalon

Apologies, it is rendering the variable, change to:


// 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

Dave J

If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Dave J

Quote from: Sir Osis of Liver on January 22, 2021, 12:03:07 PM
Clear forum cache.

That makes no difference.

Emptied in maintenance and via ftp
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

Sir Osis of Liver

Did you change something just before error appeared?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Dave J

Quote from: Sir Osis of Liver on January 22, 2021, 12:22:04 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.
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

Sir Osis of Liver

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.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

tarantula901

Thanks for your help.

It is necessary to do "Convert HTML-entities to UTF-8 characters" from the admin panel.

Unfortunately, I struggled a bit because I did not do this process because I did everything manually.

Advertisement: