xref: /PHP-7.1/ext/mysqli/tests/bug36802.phpt (revision eb0e09f5)
1--TEST--
2Bug #36802 (crashes with with mysqli_set_charset())
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7	class really_my_mysqli extends mysqli {
8		function __construct()
9		{
10		}
11	}
12
13	require_once("connect.inc");
14	$mysql = mysqli_init();
15
16	/* following operations should not work */
17	if (method_exists($mysql, 'set_charset')) {
18		$x[0] = @$mysql->set_charset('utf8');
19	} else {
20		$x[0] = NULL;
21	}
22	$x[1] = @$mysql->query("SELECT 'foo' FROM DUAL");
23
24	/* following operations should work */
25	$x[2] = ($mysql->client_version > 0);
26	$x[3] = $mysql->errno;
27	$mysql->close();
28
29	var_dump($x);
30?>
31--EXPECT--
32array(4) {
33  [0]=>
34  NULL
35  [1]=>
36  NULL
37  [2]=>
38  bool(true)
39  [3]=>
40  int(0)
41}
42