Fixed Error using spam cleaner on an account

Brettflan

Active member
Affected version
2.1.7
LogicException: Attempted to set 'discussion_state' on a deleted entity src/XF/Mvc/Entity/Entity.php:565

Stack trace

Code:
#0 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('discussion_stat...', 'deleted')
#1 src/XF/Entity/Thread.php(1010): XF\Mvc\Entity\Entity->__set('discussion_stat...', 'deleted')
#2 src/XF/Spam/Cleaner/Thread.php(80): XF\Entity\Thread->softDelete()
#3 src/XF/Spam/Cleaner.php(121): XF\Spam\Cleaner\Thread->cleanUp(Array, NULL)
#4 src/XF/Spam/Cleaner.php(106): XF\Spam\Cleaner->cleanUpContent(Array)
#5 src/XF/Pub/Controller/SpamCleaner.php(47): XF\Spam\Cleaner->cleanUp(Array)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\SpamCleaner->actionIndex(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:SpamCleaner', 'Index', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\SpamCleaner), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\SpamCleaner), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#11 src/XF.php(391): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}

Unchecking "delete spammer's threads" allows the spam cleaner to complete without error. I was then able to manually delete the user's 2 threads.

I should also note that I've had to run spam cleaner on several other accounts and didn't run into this problem for them, just for this one account so far. I'm not sure how to reproduce it.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.8).

Change log:
Prevent spam cleaner error when deleting a thread started by a spammer which has a redirect thread pointing to it.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom