Osclass Support Forums

General osclass questions => Report bug => Topic started by: dsf on May 27, 2023, 01:10:15 PM

Title: PHP 8.0.x fatal Error
Post by: dsf on May 27, 2023, 01:10:15 PM
Hi,

After switching to PHP 8, i get some of these:

[24-May-2023 23:57:32 Europe/Athens] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /home/oc-includes/osclass/helpers/hUtils.php:64

Line 64 in hUtils.php is:

Code: [Select]
if(@$item["locale"][$locale][$field] <> '') {
I have no idea when this happens and i fail to recreate it, doing all standard things, like login/register and post/edit an ad as a normal user.
Title: Re: PHP 8.0.x fatal Error
Post by: MB Themes on May 30, 2023, 09:30:33 AM
@dsf
You can replace that line with:
Code: [Select]
if(isset($item["locale"]) && isset($item["locale"][$locale]) && isset($item["locale"][$locale][$field]) && $item["locale"][$locale][$field] <> '') {
Title: Re: PHP 8.0.x fatal Error
Post by: dsf on May 30, 2023, 09:45:05 AM
Thank you, i will do that and update here with my findings.
Title: Re: PHP 8.0.x fatal Error
Post by: dsf on June 04, 2023, 06:37:09 PM
So far, so good.
Title: Re: PHP 8.0.x fatal Error
Post by: MB Themes on June 05, 2023, 10:38:03 AM
Cool  8)