diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 19eee0820..0c5d98563 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -1037,8 +1037,14 @@ function PMA_DBI_get_warnings($link = null) * @return integer $is_superuser */ function PMA_isSuperuser() { - return PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', - $GLOBALS['userlink'], PMA_DBI_QUERY_STORE); + // with mysql extension, when connection failed we don't have + // a $userlink + if (isset($GLOBALS['userlink'])) { + return PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', + $GLOBALS['userlink'], PMA_DBI_QUERY_STORE); + } else { + return false; + } } diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index a57655ba6..1e1e66e53 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -76,7 +76,7 @@ function PMA_DBI_connect($user, $password, $is_controluser = false) $link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags); } - if (empty($link) && ! $is_controluser) { + if (empty($link)) { if ($is_controluser) { trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING); return false;