xref: /PHP-8.0/ext/mysqli/tests/bug37090.phpt (revision e3e67b72)
1--TEST--
2Bug #37090 (mysqli_set_charset return code)
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7if (!function_exists('mysqli_set_charset')) {
8    die('skip mysqli_set_charset() not available');
9}
10?>
11--FILE--
12<?php
13    require_once("connect.inc");
14
15    $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
16
17    $cs = array();
18    $cs[] = $mysql->set_charset("latin1");
19    $cs[] = $mysql->character_set_name();
20
21    $cs[] = $mysql->set_charset("utf8");
22    $cs[] = $mysql->character_set_name();
23
24    $cs[] = $mysql->set_charset("notdefined");
25    $cs[] = $mysql->character_set_name();
26
27    var_dump($cs);
28    print "done!";
29?>
30--EXPECT--
31array(6) {
32  [0]=>
33  bool(true)
34  [1]=>
35  string(6) "latin1"
36  [2]=>
37  bool(true)
38  [3]=>
39  string(4) "utf8"
40  [4]=>
41  bool(false)
42  [5]=>
43  string(4) "utf8"
44}
45done!
46