Skip to content

Commit 6493b51

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix bug #80837
2 parents 3306bac + c93b461 commit 6493b51

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ PHP NEWS
2020
- Libxml:
2121
. Fixed bug #51903 (simplexml_load_file() doesn't use HTTP headers). (cmb)
2222

23+
- MySQLnd:
24+
. Fixed bug #80837 (Calling stmt_store_result after fetch doesn't throw an
25+
error). (Kamil Tekiela)
26+
2327
- Opcache:
2428
. Fixed bug #80786 (PHP crash using JIT). (Nikita)
2529
. Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1). (Dmitry)

ext/mysqli/tests/bug80837.phpt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
3+
--SKIPIF--
4+
<?php
5+
require_once 'skipif.inc';
6+
require_once 'skipifconnectfailure.inc';
7+
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
8+
?>
9+
--FILE--
10+
<?php
11+
require_once "connect.inc";
12+
13+
mysqli_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();
24+
try {
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
35+
require_once "clean_table.inc";
36+
?>
37+
--EXPECTF--
38+
Commands out of sync; you can't run this command now

ext/mysqlnd/mysqlnd_ps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)
8989

9090
/* Nothing to store for UPSERT/LOAD DATA*/
9191
if (!mysqlnd_stmt_check_state(stmt)) {
92-
SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
92+
SET_CLIENT_ERROR(stmt->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
9393
DBG_RETURN(NULL);
9494
}
9595

0 commit comments

Comments
 (0)