xref: /PHP-8.0/ext/mysqli/tests/bug52082.phpt (revision e3e67b72)
1--TEST--
2Bug #52082 (character_set_client & character_set_connection reset after mysqli_change_user)
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require_once("connect.inc");
11    $link = mysqli_init();
12    $link->options(MYSQLI_SET_CHARSET_NAME, "latin2");
13    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
14        die("can't connect");
15    }
16    var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
17    var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
18    $link->change_user($user, $passwd, $db);
19    var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
20    var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
21
22    print "done!";
23?>
24--EXPECT--
25array(2) {
26  [0]=>
27  string(20) "character_set_client"
28  [1]=>
29  string(6) "latin2"
30}
31array(2) {
32  [0]=>
33  string(24) "character_set_connection"
34  [1]=>
35  string(6) "latin2"
36}
37array(2) {
38  [0]=>
39  string(20) "character_set_client"
40  [1]=>
41  string(6) "latin2"
42}
43array(2) {
44  [0]=>
45  string(24) "character_set_connection"
46  [1]=>
47  string(6) "latin2"
48}
49done!
50