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