Trying to access array offset on value of type null

Started by Darkness7148, November 19, 2021, 06:11:15 AM

Previous topic - Next topic

Darkness7148

Been getting these errors in my error log since May 23rd 2021.

xxx?action=jsmodify;topic=163;e8918da9=aec756cbf74e7ea62fa6b4c60c685692;xml
8: Trying to access array offset on value of type null
File: xxx/forum/Sources/Post.php
Line: 3020

xxx?action=jsmodify;topic=163;e8918da9=aec756cbf74e7ea62fa6b4c60c685692;xml
8: Trying to access array offset on value of type null
File: xxx/forum/Sources/Post.php
Line: 3006

xxx?action=jsmodify;topic=163;e8918da9=aec756cbf74e7ea62fa6b4c60c685692;xml
8: Trying to access array offset on value of type null
File: xxx/forum/Sources/Post.php
Line: 3013

It appears to happen when people modify their post with the quick modify. From what I can see, the modified post is successful but it still logs this error. The error doesn't appear every single time though.

This is the code in the file:

$context['sub_template'] = 'modifydone';
if (empty($post_errors) && isset($msgOptions['subject']) && isset($msgOptions['body']))
{
$context['message'] = array(
'id' => $row['id_msg'],
'modified' => array(
'time' => isset($msgOptions['modify_time']) ? timeformat($msgOptions['modify_time']) : '',
'timestamp' => isset($msgOptions['modify_time']) ? forum_time(true, $msgOptions['modify_time']) : 0,
'name' => isset($msgOptions['modify_time']) ? $msgOptions['modify_name'] : '',
),
'subject' => $msgOptions['subject'],
'first_in_topic' => $row['id_msg'] == $row['id_first_msg'],
'body' => strtr($msgOptions['body'], array(']]>' => ']]]]><![CDATA[>')),
);

censorText($context['message']['subject']);
censorText($context['message']['body']);

$context['message']['body'] = parse_bbc($context['message']['body'], $row['smileys_enabled'], $row['id_msg']);
}



Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Darkness7148

No, lots of different topics. Doesn't seem to be any pattern.



shadav

what version of smf are you using and what version of php are you using?
===
edit I see doug asked about php, but what version of smf?

Doug Heffernan

Quote from: StarScream123 on December 05, 2021, 05:58:54 AMIt's PHP 7.4.

The error that you are getting could be caused by using outdated code on php 7.4. What mods do you have installed? And what version of smf are you using btw?

If I were you, I would refresh my forum files with those from the large 2.0.18 upgrade package, minus the ugrade files and then re-install mods one at a time to locate the one that is using obselete code. Hope it helps.

Darkness7148

It's SMF 2.0.18.

Mods:

1.    Auto Twitter Embed    2.0    [ Uninstall ] [ List Files ] [ Delete ]
3.    Simple Audio Video Embedder    5.1.2    [ Upgrade ] [ List Files ] [ Delete ]
6.    Stop Spammer    2.3.9    [ Uninstall ] [ List Files ] [ Delete ]
8.    Ignore Topics    2.3    [ Uninstall ] [ List Files ] [ Delete ]
9.    Bad Behavior mod    1.5.21    [ Uninstall ] [ List Files ] [ Delete ]
10.    Auto Merge Double Post    1.5    [ Uninstall ] [ List Files ] [ Delete ]
11.    Simple Audio Video Embedder    6.0.3    [ Uninstall ] [ List Files ] [ Delete ]
12.    Ignore User Button    1.0    [ Uninstall ] [ List Files ] [ Delete ]
13.    PM to New Members    1.2    [ Uninstall ] [ List Files ] [ Delete ]
14.    Image Quote Removal Package    1.1    [ Uninstall ] [ List Files ] [ Delete ]
15.    Spoiler Tag    0.7.2    [ Uninstall ] [ List Files ] [ Delete ]
16.    Add to Existing Ban Group    1.0.3    [ Uninstall ] [ List Files ] [ Delete ]
17.    Auto Lock Old Topics    1.3    [ Install Mod ] [ List Files ] [ Delete ]
18.    Resize Attached Images    2.4.1    [ Uninstall ] [ List Files ] [ Delete ]
20.    More Spiders    1.2    [ Uninstall ] [ List Files ] [ Delete ]
21.    Poll Moderation Logging    1.0

shadav

ok so smf version is fine, snf 2.0.18 works with php 7.4
however it could be one of your mods
can you lower your php and see if you still get the error, try 7.3 and then 7.2

most likely one of your mods is not updated
and from the error it appears to be something that edited the post page

and looking at your list of mods I'm assuming the first one off the bat there, the auto twitter embed is the culprit and needs to be updated
or possibly the Auto Lock Old Topics

Shades.

Also I see you have two "Simple Audio Video Embedder" mods installed. Not sure if that would cause the problem or not tho! ;)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Doug Heffernan

Quote from: Doug Heffernan on December 05, 2021, 06:05:35 AMIf I were you, I would refresh my forum files with those from the large 2.0.18 upgrade package, minus the ugrade files and then re-install mods one at a time to locate the one that is using obselete code. Hope it helps.

Darkness7148

I've solved the issue now.

Turns out a thing I wrote earlier in the function, I was using the $row variable for another query so it was getting overwritten. Changed the $row to something else and it works fine now.

Advertisement: