xref: /PHP-7.0/ext/mysqli/tests/bug37090.phpt (revision f281e0cf)
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}
10if ((version_compare(PHP_VERSION, '6.0', '==') == 1)) {
11	die("skip Functionality not available in unicode mode");
12}
13?>
14--FILE--
15<?php
16	require_once("connect.inc");
17
18	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
19
20	$cs = array();
21	$cs[] = $mysql->set_charset("latin1");
22	$cs[] = $mysql->character_set_name();
23
24	$cs[] = $mysql->set_charset("utf8");
25	$cs[] = $mysql->character_set_name();
26
27	$cs[] = $mysql->set_charset("notdefined");
28	$cs[] = $mysql->character_set_name();
29
30	var_dump($cs);
31	print "done!";
32?>
33--EXPECT--
34array(6) {
35  [0]=>
36  bool(true)
37  [1]=>
38  string(6) "latin1"
39  [2]=>
40  bool(true)
41  [3]=>
42  string(4) "utf8"
43  [4]=>
44  bool(false)
45  [5]=>
46  string(4) "utf8"
47}
48done!
49