Duplicate [E_NOTICE] Trying to get property 'message_date' of non-object

bottiger

Active member
Affected version
2.2
Got this error while viewing a conversation that sends me messages through the XF2 api.

Code:
ErrorException: [E_NOTICE] Trying to get property 'message_date' of non-object src/XF/Pub/Controller/Conversation.php:207
Generated by: Bottiger Jun 25, 2021 at 4:00 PM
Stack trace
#0 src/XF/Pub/Controller/Conversation.php(207): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/www/skial...', 207, Array)
#1 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Conversation->actionView(Object(XF\Mvc\ParameterBag))
#2 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF\\Pub\\Controll...', 'View', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Conversation), Object(XF\Mvc\Reply\Reroute))
#3 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Conversation), Object(XF\Mvc\Reply\Reroute))
#4 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(2337): XF\Mvc\Dispatcher->run()
#6 src/XF.php(488): XF\App->run()
#7 index.php(20): XF::runApp('XF\\Pub\\App')
#8 {main}

array(4) {
  ["url"] => string(40) "/conversations/view-report.10739/page-99"
  ["referrer"] => string(61) "https://www.skial.com/conversations/view-report.10739/page-98"
  ["_GET"] => array(1) {
    ["/conversations/view-report_10739/page-99"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

conversation.webp
 
This error could potentially be protected against, though the issue here is that the reply count is incorrect and that shouldn't be happening in the first place. That's why no messages are showing.

This is something that we have made changes to account for in 2018 and 2019 so I don't believe it should happen now. This conversation dates back to 2015 so it seems most likely that the count was already wrong but this is the first time where it was explicitly noticed.

I would rebuild conversations in the control panel which should ensure that the reply count is correct (if there are no more messages in this conversation, it should only have 98 pages for example). Then let us know if you run into it again with the current code in place. On the whole though, I suspect this relates to the previous issues identified as the cause of this, so I'm going to tag this as a duplicate of those.
 
Top Bottom