xref: /PHP-7.2/ext/mysqli/tests/bug31668.phpt (revision eb0e09f5)
1--TEST--
2Bug #31668 (multi_query works exactly every other time (multi_query was global, now per connection))
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--INI--
9error_reporting = E_ALL & ~E_STRICT
10--FILE--
11<?php
12	require_once("connect.inc");
13
14	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
15	$mysql->multi_query('SELECT 1;SELECT 2');
16	do {
17		$res = $mysql->store_result();
18		if ($mysql->errno == 0) {
19			while ($arr = $res->fetch_assoc()) {
20				var_dump($arr);
21			}
22			$res->free();
23		}
24	} while ($mysql->next_result());
25	var_dump($mysql->error, __LINE__);
26	$mysql->close();
27
28	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
29	$mysql->multi_query('SELECT 1;SELECT 2');
30	do {
31		$res = $mysql->store_result();
32		if ($mysql->errno == 0) {
33			while ($arr = $res->fetch_assoc()) {
34				var_dump($arr);
35			}
36			$res->free();
37		}
38	} while ($mysql->next_result());
39	var_dump($mysql->error, __LINE__);
40?>
41--EXPECTF--
42array(1) {
43  [1]=>
44  %s(1) "1"
45}
46array(1) {
47  [2]=>
48  %s(1) "2"
49}
50%s(0) ""
51int(%d)
52array(1) {
53  [1]=>
54  %s(1) "1"
55}
56array(1) {
57  [2]=>
58  %s(1) "2"
59}
60%s(0) ""
61int(%d)
62