Tickets Fixed Error: Call to a member function canView() on null src\addons\NF\Tickets\Entity\Message.php:62

SeToY

Well-Known Member
Code:
Server error log
Error: Call to a member function canView() on null src\addons\NF\Tickets\Entity\Message.php:62
Generated by: Merit-Seto 24 Jul 2019 at 18:13
Stack trace
#0 src\XF\Search\Data\AbstractData.php(122): NF\Tickets\Entity\Message->canView(NULL)
#1 src\XF\Search\Search.php(222): XF\Search\Data\AbstractData->canViewContent(Object(NF\Tickets\Entity\Message))
#2 [internal function]: XF\Search\Search->XF\Search\{closure}(Object(NF\Tickets\Entity\Message))
#3 src\XF\Mvc\Entity\AbstractCollection.php(189): array_filter(Array, Object(Closure))
#4 src\XF\Search\Search.php(223): XF\Mvc\Entity\AbstractCollection->filter(Object(Closure))
#5 src\XF\ResultSet.php(228): XF\Search\Search->getResultSetData('nf_tickets_mess...', Array, true, Array)
#6 src\XF\ResultSet.php(212): XF\ResultSet->loadResultsData(true)
#7 src\XF\ResultSet.php(181): XF\ResultSet->limitToViewableResults()
#8 src\XF\ResultSet.php(191): XF\ResultSet->sliceResults(0, '200', true)
#9 src\XF\Search\Search.php(166): XF\ResultSet->limitResults('200', true)
#10 src\XF\Repository\Search.php(34): XF\Search\Search->search(Object(XF\Search\Query\Query))
#11 src\XF\Pub\Controller\Search.php(395): XF\Repository\Search->runSearch(Object(XF\Search\Query\Query), Array, true)
#12 src\XF\Pub\Controller\Search.php(111): XF\Pub\Controller\Search->runSearch(Object(XF\Search\Query\Query), Array)
#13 src\XF\Mvc\Dispatcher.php(321): XF\Pub\Controller\Search->actionSearch(Object(XF\Mvc\ParameterBag))
#14 src\XF\Mvc\Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Search', 'Search', Object(XF\Mvc\RouteMatch), Object(ThemeHouse\QAForums\XF\Pub\Controller\Search), NULL)
#15 src\XF\Mvc\Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(ThemeHouse\QAForums\XF\Pub\Controller\Search), NULL)
#16 src\XF\Mvc\Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#17 src\XF\App.php(2178): XF\Mvc\Dispatcher->run()
#18 src\XF.php(390): XF\App->run()
#19 index.php(20): XF::runApp('XF\\Pub\\App')
#20 {main}
Request state
array(4) {
  ["url"] => string(14) "/search/search"
  ["referrer"] => string(44) "https://domain.com/forums/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(3) {
    ["keywords"] => string(10) "Verbindung"
    ["c"] => array(1) {
      ["users"] => string(0) ""
    }
    ["_xfToken"] => string(8) "********"
  }
}
 

SeToY

Well-Known Member
Easy to reproduce: Open a member profile. Click on "Find" -> "Find all content" -> Error
 

NixFifty

Administrator
Staff member
I can't actually reproduce this. I notice a ThemeHouse add-on in the stack trace. Shot in the dark but what happens if you disable that and try?
 

SeToY

Well-Known Member
It doesn't happen anymore for some reason. I suspect this has something to do with a users ticket being deleted and some kind of cleanup job?

Try that:
- Create a ticket
- Delete ticket (hard)
Open a member profile. Click on "Find" -> "Find all content" -> Error
Maybe there is some residue left for the first few minutes after a ticket has been deleted?
 

FrederikP

Member
Same here

Code:
Error: Call to a member function canView() on null src/addons/NF/Tickets/Entity/Message.php:62
Generated by: user Jul 25, 2019 at 7:27 PM

Stack trace
#0 src/XF/Search/Data/AbstractData.php(122): NF\Tickets\Entity\Message->canView(NULL)
#1 src/XF/Search/Search.php(222): XF\Search\Data\AbstractData->canViewContent(Object(NF\Tickets\Entity\Message))
#2 [internal function]: XF\Search\Search->XF\Search\{closure}(Object(NF\Tickets\Entity\Message))
#3 src/XF/Mvc/Entity/AbstractCollection.php(189): array_filter(Array, Object(Closure))
#4 src/XF/Search/Search.php(223): XF\Mvc\Entity\AbstractCollection->filter(Object(Closure))
#5 src/XF/ResultSet.php(228): XF\Search\Search->getResultSetData('nf_tickets_mess...', Array, true, Array)
#6 src/XF/ResultSet.php(212): XF\ResultSet->loadResultsData(true)
#7 src/XF/ResultSet.php(181): XF\ResultSet->limitToViewableResults()
#8 src/XF/ResultSet.php(191): XF\ResultSet->sliceResults(0, '1000', true)
#9 src/XF/Search/Search.php(166): XF\ResultSet->limitResults('1000', true)
#10 src/XF/Repository/Search.php(34): XF\Search\Search->search(Object(SV\ElasticSearchEssentials\XF\Search\Query\Query))
#11 src/addons/SV/ElasticSearchEssentials/XF/Repository/Search.php(29): XF\Repository\Search->runSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\Query), Array, true)
#12 src/XF/Pub/Controller/Search.php(395): SV\ElasticSearchEssentials\XF\Repository\Search->runSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\Query), Array, true)
#13 src/XF/Pub/Controller/Search.php(111): XF\Pub\Controller\Search->runSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\Query), Array)
#14 src/addons/SV/SearchImprovements/XF/Pub/Controller/Search.php(55): XF\Pub\Controller\Search->actionSearch()
#15 src/addons/SV/ElasticSearchEssentials/XF/Pub/Controller/Search.php(222): SV\SearchImprovements\XF\Pub\Controller\Search->actionSearch()
#16 src/XF/Mvc/Dispatcher.php(321): SV\ElasticSearchEssentials\XF\Pub\Controller\Search->actionSearch(Object(XF\Mvc\ParameterBag))
#17 src/XF/Mvc/Dispatcher.php(244): XF\Mvc\Dispatcher->dispatchClass('XF:Search', 'Search', Object(XF\Mvc\RouteMatch), Object(SV\ElasticSearchEssentials\XF\Pub\Controller\Search), NULL)
#18 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\ElasticSearchEssentials\XF\Pub\Controller\Search), NULL)
#19 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#20 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#21 src/XF.php(390): XF\App->run()
#22 index.php(20): XF::runApp('XF\\Pub\\App')
#23 {main}

Request state

array(4) {
  ["url"] => string(14) "/search/search"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["/search/search"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["keywords"] => string(0) ""
    ["c"] => array(2) {
      ["title_only"] => string(1) "1"
      ["users"] => string(0) ""
    }
    ["_xfToken"] => string(8) "********"
  }
}
Capture.PNG
 

NixFifty

Administrator
Staff member
Hasn't been uploaded here yet but I'll release a fresh package soon. Just wrapping up the last few outstanding items.
 
Top