xref: /PHP-8.0/ext/mysqli/tests/bug80837.phpt (revision c93b461a)
1--TEST--
2Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
3--SKIPIF--
4<?php
5require_once 'skipif.inc';
6require_once 'skipifconnectfailure.inc';
7if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
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--EXPECTF--
38Commands out of sync; you can't run this command now
39