diff options
| author | Ulf Wendel <uw@php.net> | 2011-03-23 08:57:52 +0000 |
|---|---|---|
| committer | Ulf Wendel <uw@php.net> | 2011-03-23 08:57:52 +0000 |
| commit | 1eb3bdd802748f52416cb318cfd03c9b7c989730 (patch) | |
| tree | 654ee6b4340dd5ced535b2462b6d7802b391af5a | |
| parent | b2d384355d5cf653ebe96ae149d1384063658eab (diff) | |
| download | php-git-1eb3bdd802748f52416cb318cfd03c9b7c989730.tar.gz | |
Coverage for a 'silent server protocol change' from the past for which both mysqlnd and libmysql have workarounds.
| -rw-r--r-- | ext/mysqli/tests/mysqli_change_user.phpt | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt index a9b8ae7ade..bfea423c9e 100644 --- a/ext/mysqli/tests/mysqli_change_user.phpt +++ b/ext/mysqli/tests/mysqli_change_user.phpt @@ -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!"; ?> |
