Fixed XF\Reaction\AbstractHandler::updateContentReactions no check for deleted reactions

Xon

Well-known member
Affected version
2.2.6
Every other location which touches container('reactions') guards against the reaction id being tested against actually exists in the cache. This appears to be the only place which doesn't.

This can result in a race condition between a post reaction cache being rebuilt and the reactions container cache being rebuilt.
PHP:
if ($scoreField)
{
   $reactionsCache = \XF::app()->container('reactions');
   $score = 0;
   foreach ($counts AS $reactionId => $count)
   {
      $reaction = $reactionsCache[$reactionId];
      $score += $count * $reaction['reaction_score'];
   }

This can occur as the content reaction cache is rebuilt when other reactions are used, as it does an raw SQL check against xf_reaction.active column. While the reactions container cache rebuild is punted to after the reaction update transaction.
 
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.2.7).

Change log:
When updating content reactions, check if reactions actually exist in the cache
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom