mirror of
https://github.com/php/php-src.git
synced 2024-12-01 13:54:10 +08:00
Coverage for a 'silent server protocol change' from the past for which both mysqlnd and libmysql have workarounds.
This commit is contained in:
parent
b2d384355d
commit
1eb3bdd802
@ -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!";
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user