1--TEST--
2mysqli_change_user() - Prepared Statement
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require_once 'connect.inc';
12
13    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
14        printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
15
16    if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'"))
17        printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
18
19    mysqli_change_user($link, $user, $passwd, $db);
20
21    $wrong = null;
22    if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) {
23        printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong);
24    } else {
25        if ($stmt->errno == 0)
26            printf("Error code 2013, 1243 or similar should have been set\n");
27    }
28
29    mysqli_close($link);
30    print "done!";
31?>
32--EXPECT--
33done!
34