MyBB Community Forums
[Duplicate] Division by zero in managegroup.php - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Development (https://community.mybb.com/forum-161.html)
+--- Forum: MyBB 1.8 Development (https://community.mybb.com/forum-165.html)
+---- Forum: 1.8 Bugs and Issues (https://community.mybb.com/forum-157.html)
+----- Forum: Rejected (https://community.mybb.com/forum-184.html)
+----- Thread: [Duplicate] Division by zero in managegroup.php (/thread-222001.html)



Division by zero in managegroup.php - StefanT - 2019-02-17

$per_page is not defined in managegroup.php (line 358) and throws a Division by zero warning:
	$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)
		{
			$start = 0;
			$page = 1;
		}
	}
	else
	{
		$start = 0;
		$page = 1;
	}



RE: Division by zero in managegroup.php - effone - 2019-02-17

I can see $perpage is defined in your posted code and reset to hardcoded default in case of less than 1.
More reproduction steps needed...


RE: Division by zero in managegroup.php - StefanT - 2019-02-17

I'm talking about $per_page.


RE: Division by zero in managegroup.php - Euan T - 2019-02-17

This appears to be fixed in the feature branch, and should be fixed in 1.8.20: https://github.com/mybb/mybb/blob/feature/managegroup.php#L358