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