From c93b461ad70e341f1b01f5910f3cfc3055a3941e Mon Sep 17 00:00:00 2001 From: Dharman Date: Fri, 5 Mar 2021 21:45:27 +0000 Subject: Fix bug #80837 The error needs to be reported on the statement, not the connection. --- ext/mysqli/tests/bug80837.phpt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ext/mysqli/tests/bug80837.phpt (limited to 'ext/mysqli') diff --git a/ext/mysqli/tests/bug80837.phpt b/ext/mysqli/tests/bug80837.phpt new file mode 100644 index 0000000000..71e31aa31b --- /dev/null +++ b/ext/mysqli/tests/bug80837.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #80837 Calling stmt_store_result after fetch doesn't throw an error +--SKIPIF-- + +--FILE-- +query('DROP TABLE IF EXISTS test'); +$mysqli->query('CREATE TABLE test (b int)'); +$mysqli->query('INSERT INTO test VALUES (1),(2),(3)'); + +$statement = $mysqli->prepare("SELECT b FROM test"); +$statement->execute(); +$statement->bind_result($name); +$statement->fetch(); +try { + $statement->store_result(); +} catch (mysqli_sql_exception $e) { + echo $e->getMessage(); +} + +$mysqli->close(); + +?> +--CLEAN-- + +--EXPECTF-- +Commands out of sync; you can't run this command now -- cgit v1.2.1