Fixed Division by zero

drastic

Well-known member
Saw this a few times today.

Any idea how to fix?

Thanks

Division by zero Today at 2:35 PM - library/XenGallery/ControllerPublic/Comment.php:48
 
That's all that was in the server error log when I logged into my XF admin. Is there a different spot that has more info?
 
ErrorException: Division by zero - library/XenGallery/ControllerPublic/Comment.php:48
Generated By: Unknown Account, Yesterday at 2:45 PM
Stack Trace
#0 /mypathhere.com/library/XenGallery/ControllerPublic/Comment.php(48): XenForo_Application::handlePhpError(2, 'Division by zer...', '/mypath/...', 48, Array)
#1 /mypathhere.com/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_Comment->actionIndex()
#2 /mypathhere.com/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#3 /mypathhere.com/index.php(13): XenForo_FrontController->run()
#4 {main}
Request State
array(3) {
["url"] => string(47) "https://www.mydomain.com/media/comments/2/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
PHP:
$page = floor($commentsBefore / $commentsPerPage) + 1;
is the line erroring. Do you have the option xengalleryMaxCommentsPerPage set to 0?

It might be a good idea for
PHP:
$commentsPerPage = XenForo_Application::getOptions()->xengalleryMaxCommentsPerPage;
to get changed to
PHP:
$commentsPerPage = max(1, XenForo_Application::getOptions()->xengalleryMaxCommentsPerPage);
 
It's in the Options.

Admin CP > Applications > Gallery Options > Page Layout Options > "Max number of comments (per page)"
 
Top Bottom