xref: /php-src/ext/mysqli/tests/bug80837.phpt (revision 6fb1c7a7)
1--TEST--
2Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11require_once 'connect.inc';
12
13mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
14$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
15
16$mysqli->query('DROP TABLE IF EXISTS test');
17$mysqli->query('CREATE TABLE test (b int)');
18$mysqli->query('INSERT INTO test VALUES (1),(2),(3)');
19
20$statement = $mysqli->prepare("SELECT b FROM test");
21$statement->execute();
22$statement->bind_result($name);
23$statement->fetch();
24try {
25    $statement->store_result();
26} catch (mysqli_sql_exception $e) {
27    echo $e->getMessage();
28}
29
30$mysqli->close();
31
32?>
33--CLEAN--
34<?php
35require_once 'clean_table.inc';
36?>
37--EXPECT--
38Commands out of sync; you can't run this command now
39