MyBB Community Forums

Full Version: Page Change in Managegroup causes "Division by zero" Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, in my forum I have certain usergroups that can be joined/approved etc. I noticed that in these group pages (managegroup.php) when I click on page 2 or 3 to see other users I get this error:

Quote:Warning [2] Division by zero - Line: 358 - File: managegroup.php PHP 7.0.29 (Linux)

This doesn't happen at page 1. Happens only at other pages.

My managegroup.php doesn't have any changes.

Can someone check this and provide a fix if it's possible?
I can confirm this.
I can confirm this, any suggested fix?
Line: 358 - File: managegroup.php

I had a look, and is $per_page a typo perhaps ? i don't see it defined anywhere.

if you change to $perpage the error is gone.
That looks right, pushing this to GitHub.
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3468

Thanks for contributing to MyBB!

Regards,
The MyBB Group
(2018-10-14, 01:34 PM)Eldenroot Wrote: [ -> ]I can confirm this, any suggested fix?

As @Ashley1 stated, there is a '$per_page' code (in line 7 of the code below), but line 6 points to '$perpage'.  

	$perpage = (int)$mybb->settings['membersperpage'];
	if($perpage < 1)
	{
		$perpage = 20;
	}

	$page = $mybb->get_input('page', MyBB::INPUT_INT);
	if($page && $page > 0)
	{
		$start = ($page-1) * $perpage;
		$pages = ceil($numusers / $per_page);
		if($page > $pages)
		{

Change that to '$perpage' in line 7 and the problem is solved.