Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: Pyrhel on February 14, 2022, 05:50:45 AM

Title: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Pyrhel on February 14, 2022, 05:50:45 AM
Several times a day in the error log I'm getting:

General Error "2: Trying to access array offset on value of type null"
on line 2263 of Subs-Editor.php file.

All errors are logged by guest users, but I cannot reproduce them - i've tried to access the page when logged-in and as a guest, but such errors are not generated.

I'll be glad to provide full info - tell me what you'll need.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Doug Heffernan on February 14, 2022, 06:08:16 AM
Quote from: Pyrhel on February 14, 2022, 05:50:45 AMSeveral times a day in the error log I'm getting:

General Error "2: Trying to access array offset on value of type null"
on line 2263 of Subs-Editor.php file.

All errors are logged by guest users, but I cannot reproduce them - i've tried to access the page when logged-in and as a guest, but such errors are not generated.

I'll be glad to provide full info - tell me what you'll need.

What version of smf do you use? And what version of php are you at?
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Arantor on February 14, 2022, 09:21:15 AM
We've seen this bug reported before but we never got to the bottom of it. Looks like the anti spam Q&A cache isn't populated for some reason.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Pyrhel on February 14, 2022, 09:31:04 AM
Quote from: Doug Heffernan on February 14, 2022, 06:08:16 AMWhat version of smf do you use? And what version of php are you at?
I'm sorry, SMF 2.1.1 on PHP 8.0.15

If I can help tracing it - just write how I can help.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Doug Heffernan on February 14, 2022, 10:16:21 AM
Quote from: Pyrhel on February 14, 2022, 09:31:04 AM
Quote from: Doug Heffernan on February 14, 2022, 06:08:16 AMWhat version of smf do you use? And what version of php are you at?
I'm sorry, SMF 2.1.1 on PHP 8.0.15

If I can help tracing it - just write how I can help.

Can you downgrade php version to php 7.4 and see if the error will still occur?
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Pyrhel on February 15, 2022, 02:33:13 AM
Hello, I've set it to 7.4 and I'll report back soon.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Pogo Stick on February 17, 2022, 10:27:12 AM
I had this same error a couple of times on 2.1.1, PHP 7.4.

I cleared the cache, not sure if that fixed it or not.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Sesquipedalian on February 18, 2022, 02:06:45 AM
This sounds like #7304 (https://github.com/SimpleMachines/SMF2.1/issues/7304), which has a pending fix in #7312 (https://github.com/SimpleMachines/SMF2.1/pull/7312).
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Pyrhel on February 18, 2022, 02:26:28 AM
Since I've switched to 7.4 the problems are gone.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Doug Heffernan on February 18, 2022, 08:16:05 AM
Quote from: Pyrhel on February 18, 2022, 02:26:28 AMSince I've switched to 7.4 the problems are gone.

Like I thought, a php version incompatibility.
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Pogo Stick on February 19, 2022, 06:14:09 AM
Quote from: Doug Heffernan on February 18, 2022, 08:16:05 AM
Quote from: Pyrhel on February 18, 2022, 02:26:28 AMSince I've switched to 7.4 the problems are gone.

Like I thought, a php version incompatibility.

Except that, as I said above, I got this same error with PHP 7.4
Title: Re: "Trying to access array offset on value of type null" in Subs-Editor.php
Post by: Doug Heffernan on February 19, 2022, 06:34:24 AM
Quote from: Pogo Stick on February 19, 2022, 06:14:09 AM
Quote from: Doug Heffernan on February 18, 2022, 08:16:05 AM
Quote from: Pyrhel on February 18, 2022, 02:26:28 AMSince I've switched to 7.4 the problems are gone.

Like I thought, a php version incompatibility.

Except that, as I said above, I got this same error with PHP 7.4

And as you can see, I was talking to the OP, not you.

Did you try the solution posted by @Sesquipedalian above?