1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Division by zero

Discussion in 'Media Gallery Resolved Bugs' started by drastic, Jan 1, 2016.

Tags:
  1. drastic

    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
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Which XFMG version?
     
  3. drastic

    drastic Well-Known Member

    Latest.
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    Could you post the full stack trace from the server error log?
     
  5. drastic

    drastic Well-Known Member

    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?
     
  6. Chris D

    Chris D XenForo Developer Staff Member

    You can click on the server error entry and it will load the full stack trace of the error.
     
  7. drastic

    drastic Well-Known Member

    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) {
    }
    }
     
  8. Daniel Hood

    Daniel Hood Well-Known Member

    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(1XenForo_Application::getOptions()->xengalleryMaxCommentsPerPage);
     
    SneakyDave likes this.
  9. drastic

    drastic Well-Known Member

    Is that something I'd find in a template somewhere? A template search came up empty in my XF admin.
     
  10. Chris D

    Chris D XenForo Developer Staff Member

    It's in the Options.

    Admin CP > Applications > Gallery Options > Page Layout Options > "Max number of comments (per page)"
     
  11. drastic

    drastic Well-Known Member

    I changed that number. Shall see if it helps.

    Thanks.
     
  12. Chris D

    Chris D XenForo Developer Staff Member

    We shouldn't be allowing 0 here so this is changed in the next release. Thanks.
     
    drastic and thedude like this.
  13. drastic

    drastic Well-Known Member

    Cool! I found hidden treasure!!
     

Share This Page