Coverage for a 'silent server protocol change' from the past for which both mysqlnd and libmysql have workarounds.

This commit is contained in:
Ulf Wendel 2011-03-23 08:57:52 +00:00
parent b2d384355d
commit 1eb3bdd802

View File

@ -83,8 +83,28 @@ require_once('skipifconnectfailure.inc');
mysqli_close($link);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
/* silent protocol change if no db which requires workaround in mysqlnd/libmysql
(empty db = no db send with COM_CHANGE_USER) */
if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$tmp = mysqli_fetch_assoc($res);
mysqli_free_result($res);
if ($tmp['dbname'] != "")
printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']);
mysqli_close($link);
if (NULL !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
printf("[022] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
printf("[026] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>