1--TEST--
2mysqli_change_user(), MySQL 5.6+
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifemb.inc');
7require_once('skipifconnectfailure.inc');
8
9if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
10	die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
11		$host, $user, $db, $port, $socket));
12
13if (mysqli_get_server_version($link) < 50600)
14	die("SKIP For MySQL >= 5.6.0");
15?>
16--FILE--
17<?php
18	require_once("connect.inc");
19
20	$tmp	= NULL;
21	$link	= NULL;
22
23	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
24		printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
25			$host, $user, $db, $port, $socket);
26
27	/* Pre 5.6: link remains useable */
28	if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
29		printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
30
31	if (!$res = mysqli_query($link, 'SELECT 1 AS _one'))
32		printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
33
34	var_dump($res->fetch_assoc());
35
36	print "done!";
37?>
38--EXPECTF--
39Warning: mysqli_query(): MySQL server has gone away in %s on line %d
40
41Warning: mysqli_query(): Error reading result set's header in %s on line %d
42[003] [2006] MySQL server has gone away
43
44Fatal error: Call to a member function fetch_assoc() on %s in %s on line %d