Not a bug Error log from reports

Jake B.

Well-known member
Affected version
2.2.6 Patch 2
ErrorException: [E_NOTICE] Undefined index: node_id src/XF/Report/Post.php:12

#0 src/XF/Report/Post.php(12): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/srv/www/...', 12, Array)
#1 src/XF/Report/AbstractHandler.php(19): XF\Report\Post->canViewContent(Object(XF\Entity\Report))
#2 src/XF/Entity/Report.php(45): XF\Report\AbstractHandler->canView(Object(XF\Entity\Report))
#3 src/XF/Mvc/Entity/AbstractCollection.php(320): XF\Entity\Report->canView()
#4 [internal function]: XF\Mvc\Entity\AbstractCollection->XF\Mvc\Entity\{closure}(Object(XF\Entity\Report))
#5 src/XF/Mvc/Entity/AbstractCollection.php(189): array_filter(Array, Object(Closure))
#6 src/XF/Mvc/Entity/AbstractCollection.php(321): XF\Mvc\Entity\AbstractCollection->filter(Object(Closure))
#7 src/XF/Pub/App.php(304): XF\Mvc\Entity\AbstractCollection->filterViewable()
#8 src/XF/Pub/App.php(197): XF\Pub\App->updateModeratorCaches()
#9 src/XF/App.php(2340): XF\Pub\App->start(true)
#10 src/XF.php(512): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}

Getting tons of these logged. Not able to track down a specific report that is causing it, but there are hundreds of pages of these since the site was upgraded to XF 2.2 from XF 1.5 so I'm guessing it's related to some old report from XF 1 that doesn't have the necessary details stored
In the first instance we probably do need to do some troubleshooting here.

For reference the content_info field of the Report record for the post type has always had a node_id key dating all the way back to XF 1.0, without any particular isset checks or similar because every post report for over a decade has had that information inserted.

Therefore there's no expectation for this to be present in XF 1.x and be missing in XF 2.x so this would have presented itself sooner.

If you can track down the problematic record(s) then that might shed some light. The only working theory I have right now is that this field contained PHP serialized data in XF 1.0 to XF 2.0 but should have been converted to JSON as the upgrade process passed through XF 2.1 upgrade steps.

That could be one explanation. Aside from that it could be report records where the content_info is empty or simply missing the node_id key but then the question is how that happened.

Apart from that, actually, probably before checking all that, it would be worth disabling add-ons/listeners to see if that changes the result in case there is anything unexpectedly overriding or modifying the content_info column.

If you can look into that and let us know we can see what the next steps are.

Thanks Chris.

So we have 22 records with content_info still containing serialised data, but it's strange because it's only a fairly recent bunch that haven't been converted. Having looked into the background of the upgrade, it seems like some data may have (for whatever reason) been manually inserted by someone without realising it needed to go through a migration process. I've just marked them all as rejected and there's no more errors.

I'd say safe to close this as not a bug.
Top Bottom