Fixed Member stat

kick

Well-known member
Affected version
2.0.0 Beta 1
Code:
InvalidArgumentException: Attempted to convert object to JSON array (cache_results) in src\XF\Mvc\Entity\Entity.php at line 763
XF\Mvc\Entity\Entity->_castValueToType() in src\XF\Mvc\Entity\Entity.php at line 614
XF\Mvc\Entity\Entity->set() in src\XF\Mvc\Entity\Entity.php at line 554
XF\Mvc\Entity\Entity->__set() in src\XF\Service\MemberStat\Preparer.php at line 65
XF\Service\MemberStat\Preparer->cache() in src\XF\Service\MemberStat\Preparer.php at line 88
XF\Service\MemberStat\Preparer->getResults() in src\XF\Entity\MemberStat.php at line 68
XF\Entity\MemberStat->getResults() in src\XF\Pub\Controller\Member.php at line 110
XF\Pub\Controller\Member->actionIndex() in src\XF\Mvc\Dispatcher.php at line 232
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 85
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 1771
XF\App->run() in src\XF.php at line 319
XF::runApp() in index.php at line 13
steps for reproduce:
  1. Install forum
  2. Remove from user "Team forum"
  3. Go to at the link index.php?Members/
 
I was getting this error too at /members when all members of moderating and administrative groups were not set to "show as staff."

Setting just one of those users to "show as staff" fixes the error (as @kick points out), but I'd prefer the option of not having staff listed at /members.
 
Table: xf_member_stat
Column: cache_results
Change the value from Null to (Blob) 2 bytes
These 2 bytes are []. This is a temporary solution
 
FYI, this also gets rid of the error when all members of moderating and administrative groups are not set to "show as staff":

Groups & permissions > Member statistics > Disable "Staff members"
 
It hasn't been a week yet since the release of Beta 4. But, even so, although we are trying our best to do these releases weekly, it cannot always be guaranteed.
 
Back
Top Bottom