MyBB Community Forums

Full Version: Fix PHP Notice in db_mysqli.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

it would be nice, if you could fix the PHP Notice errors in db_mysqli.php. These are only very small changes. Maybe they can be included in the next bugfix version.

line 169:
if(!is_array($connections[$type]))
{
	break;
}
changed to
if(!isset($connections[$type]) || !is_array($connections[$type]))
{
	break;
}

line 198:
// Specified a custom port for this connection?
list($hostname, $port) = explode(":", $single_connection['hostname'], 2);
if($port)
{
	$this->$link = @$connect_function($persist.$hostname, $single_connection['username'], $single_connection['password'], "", $port);
}
changed to
// Specified a custom port for this connection?
$host = explode(":", $single_connection['hostname'], 2);
if(isset($host[1]))
{
	$this->$link = @$connect_function($persist.$hostname, $single_connection['username'], $single_connection['password'], "", $host[1]);
}

This one will only be raised, if for any reason $mybb isn't defined. This will never happen in the productive system, but using the database object itself in a plugin or development process, this may happen.
line 324:
if($mybb->debug_mode)
{
	$this->explain_query($string, $query_time);
}
changed to
if(!empty($mybb) && $mybb->debug_mode)
{
	$this->explain_query($string, $query_time);
}
I'm pretty sure Rasmus Lerdorf fixed these. We'll be fixing a good deal of PHP notices in 1.6.9. Smile