1--TEST--
2mysqli_change_user(), MySQL 5.6+
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'connect.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
16if (mysqli_get_server_version($link) >= 10_00_00)
17    die("SKIP Not applicable for MariaDB");
18?>
19--FILE--
20<?php
21    require_once 'connect.inc';
22
23    $tmp	= NULL;
24    $link	= NULL;
25
26    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
27        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
28            $host, $user, $db, $port, $socket);
29
30    /* Pre 5.6: link remains useable */
31    if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
32        printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
33
34    if (!$res = mysqli_query($link, 'SELECT 1 AS _one'))
35        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
36    else
37        var_dump($res->fetch_assoc());
38
39    print "done!";
40?>
41--EXPECT--
42[003] [2006] MySQL server has gone away
43done!
44