1--TEST--
2Error in multi query
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10
11require_once __DIR__ . '/connect.inc';
12
13mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
14
15$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
16
17$mysqli->multi_query("SELECT 1; SELECT 2; Syntax Error");
18
19try {
20    do {
21        if ($res = $mysqli->store_result()) {
22            var_dump($res->fetch_all(MYSQLI_ASSOC));
23            $res->free();
24        }
25    } while ($mysqli->more_results() && $mysqli->next_result());
26} catch (mysqli_sql_exception $e) {
27    echo $e->getMessage(), "\n";
28}
29
30$mysqli->query("DROP PROCEDURE IF EXISTS p");
31$mysqli->query('CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT 1; SELECT foobar FROM table_that_does_not_exist; END;');
32
33$stmt = $mysqli->prepare("CALL p()");
34$stmt->execute();
35
36try {
37    do {
38        $stmt->bind_result($num);
39        while ($stmt->fetch()) {
40            echo "num = $num\n";
41        }
42    } while ($stmt->more_results() && $stmt->next_result());
43} catch (mysqli_sql_exception $e) {
44    echo $e->getMessage(), "\n";
45}
46
47$mysqli->query("DROP PROCEDURE IF EXISTS p");
48
49?>
50--EXPECTF--
51array(1) {
52  [0]=>
53  array(1) {
54    [1]=>
55    string(1) "1"
56  }
57}
58array(1) {
59  [0]=>
60  array(1) {
61    [2]=>
62    string(1) "2"
63  }
64}
65You have an error in your SQL syntax; %s
66num = 1
67Table '%s.table_that_does_not_exist' doesn't exist
68