xref: /PHP-8.0/ext/mysqli/tests/bug31668.phpt (revision e3e67b72)
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--FILE--
9<?php
10    require_once("connect.inc");
11
12    $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
13    $mysql->multi_query('SELECT 1;SELECT 2');
14    do {
15        $res = $mysql->store_result();
16        if ($mysql->errno == 0) {
17            while ($arr = $res->fetch_assoc()) {
18                var_dump($arr);
19            }
20            $res->free();
21        }
22    } while ($mysql->next_result());
23    var_dump($mysql->error, __LINE__);
24    $mysql->close();
25
26    $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
27    $mysql->multi_query('SELECT 1;SELECT 2');
28    do {
29        $res = $mysql->store_result();
30        if ($mysql->errno == 0) {
31            while ($arr = $res->fetch_assoc()) {
32                var_dump($arr);
33            }
34            $res->free();
35        }
36    } while ($mysql->next_result());
37    var_dump($mysql->error, __LINE__);
38?>
39--EXPECTF--
40array(1) {
41  [1]=>
42  %s(1) "1"
43}
44array(1) {
45  [2]=>
46  %s(1) "2"
47}
48%s(0) ""
49int(%d)
50array(1) {
51  [1]=>
52  %s(1) "1"
53}
54array(1) {
55  [2]=>
56  %s(1) "2"
57}
58%s(0) ""
59int(%d)
60