Fixed Error during message move / rebuild threads

akhan

Active member
Affected version
2.1.0
Error message:

InvalidArgumentException: Attempted to convert NULL to JSON array [first_post_reactions]
src/XF/Mvc/Entity/Entity.php:728

Code:
#0 src/XF/Mvc/Entity/Entity.php(612): XF\Mvc\Entity\Entity->_castValueToType(NULL, 'first_post_reac...', 65552, Array)
#1 src/XF/Mvc/Entity/Entity.php(542): XF\Mvc\Entity\Entity->set('first_post_reac...', NULL)
#2 src/XF/Entity/Thread.php(610): XF\Mvc\Entity\Entity->__set('first_post_reac...', NULL)
#3 src/XF/Entity/Thread.php(582): XF\Entity\Thread->rebuildFirstPostInfo()
#4 src/XF/Service/Post/Mover.php(202): XF\Entity\Thread->rebuildCounters()
#5 src/XF/Service/Post/Mover.php(144): XF\Service\Post\Mover->updateTargetData()
#6 src/XF/InlineMod/Post/Move.php(39): XF\Service\Post\Mover->move(Array)
#7 src/XF/InlineMod/AbstractAction.php(80): XF\InlineMod\Post\Move->applyInternal(Object(XF\Mvc\Entity\ArrayCollection), Array)
#8 src/XF/Pub/Controller/InlineMod.php(131): XF\InlineMod\AbstractAction->apply(Object(XF\Mvc\Entity\ArrayCollection), Array)
#9 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\InlineMod->actionPerform(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:InlineMod', 'Perform', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\InlineMod), Object(XF\Mvc\Reply\Reroute))
#11 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\InlineMod), Object(XF\Mvc\Reply\Reroute))
#12 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(2155): XF\Mvc\Dispatcher->run()
#14 src/XF.php(389): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}
 
I haven't looked at this in a great amount of detail, yet, but just to be clear; did this happen to you guys in Beta 1 or Beta 2? If it was Beta 1 and you upgrade to Beta 2, does that fix it?
 
Same thing

Beta 2

InvalidArgumentException: Attempted to convert NULL to JSON array [first_post_reactions] in src/XF/Mvc/Entity/Entity.php at line 728
  1. XF\Mvc\Entity\Entity->_castValueToType() in src/XF/Mvc/Entity/Entity.php at line 612
  2. XF\Mvc\Entity\Entity->set() in src/XF/Mvc/Entity/Entity.php at line 542
  3. XF\Mvc\Entity\Entity->__set() in src/XF/Entity/Thread.php at line 610
  4. XF\Entity\Thread->rebuildFirstPostInfo() in src/XF/Entity/Thread.php at line 582
  5. XF\Entity\Thread->rebuildCounters() in src/XF/Service/Post/Mover.php at line 202
  6. XF\Service\Post\Mover->updateTargetData() in src/XF/Service/Post/Mover.php at line 144
  7. XF\Service\Post\Mover->move() in src/XF/InlineMod/Post/Move.php at line 39
  8. XF\InlineMod\Post\Move->applyInternal() in src/XF/InlineMod/AbstractAction.php at line 80
  9. XF\InlineMod\AbstractAction->apply() in src/XF/Pub/Controller/InlineMod.php at line 131
  10. XF\Pub\Controller\InlineMod->actionPerform() in src/XF/Mvc/Dispatcher.php at line 321
  11. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
  12. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
  13. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
  14. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2155
  15. XF\App->run() in src/XF.php at line 389
  16. XF::runApp() in index.php at line 20
 
Same problem goes for me on Beta 2.1, when merging posts :

Code:
[LIST]
[*]InvalidArgumentException: Attempted to convert NULL to JSON array [first_post_reactions]
[*]src/XF/Mvc/Entity/Entity.php:728
[/LIST]

Regards
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.1.0 Beta 3).

Change log:
prevent an error when rebuilding threads if the first post reaction users does not decode to an array.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom