Fixed Trending Content: DivisionByZeroError

Chromaniac

Well-known member
Affected version
2.3 Beta 6
So, woke up to these errors in backend:

Code:
DivisionByZeroError: Division by zero src/XF/Repository/TrendingContent.php:295
Generated by: Unknown account May 13, 2024 at 1:15 PM
Stack trace
#0 src/XF/Repository/TrendingContent.php(116): XF\Repository\TrendingContent->normalizeContentData(Array)
#1 src/XF/Job/TrendingResult.php(30): XF\Repository\TrendingContent->createResult('top', 10, 'thread', 374)
#2 src/XF/Job/Manager.php(272): XF\Job\TrendingResult->run(8)
#3 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#4 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#5 job.php(43): XF\Job\Manager->runQueue(false, 8)
#6 {main}

Tried changing around trending configurations in case I messed up something but nothing seemed to have helped. Also noticed that there was an error for unfinished tasks. Ran the command on CLI to get this.

Code:
php cmd.php xf:run-jobs
In TrendingContent.php line 295:
  Division by zero
In TrendingContent.php line 295:
  Division by zero
xf:run-jobs [--max-execution-time [MAX-EXECUTION-TIME]] [--wait] [--manual-only]

I disabled logging and this error seems to have stopped for now. I have run the file check and all files seems as expected.
 
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.3.0 Beta 7).

Change log:
Fix division by zero when normalizing trending result content with the same score
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom