mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Prevent mysqli::next_result from reporting errors from previous calls (#7304)
This commit is contained in:
parent
1fa26eccba
commit
d26069a2f1
3 changed files with 30 additions and 5 deletions
28
ext/mysqli/tests/mysqli_next_result_no_repeat_error.phpt
Normal file
28
ext/mysqli/tests/mysqli_next_result_no_repeat_error.phpt
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
--TEST--
|
||||||
|
next_result reports errors from previous calls
|
||||||
|
--EXTENSIONS--
|
||||||
|
mysqli
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
require_once 'skipifconnectfailure.inc';
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/connect.inc';
|
||||||
|
|
||||||
|
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||||
|
|
||||||
|
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$mysqli->query("Syntax Error");
|
||||||
|
} catch (mysqli_sql_exception $e) {
|
||||||
|
}
|
||||||
|
$mysqli->next_result();
|
||||||
|
|
||||||
|
print "done!";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
done!
|
|
@ -331,14 +331,10 @@ Warning: mysqli_rollback(): (%s/%d): Commands out of sync; you can't run this co
|
||||||
|
|
||||||
Warning: mysqli_stmt_prepare(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
Warning: mysqli_stmt_prepare(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
||||||
|
|
||||||
Warning: mysqli_next_result(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
|
||||||
|
|
||||||
Warning: mysqli_next_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
Warning: mysqli_next_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
||||||
|
|
||||||
Warning: mysqli_store_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
Warning: mysqli_store_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
||||||
|
|
||||||
Warning: mysqli_next_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
|
||||||
|
|
||||||
Warning: mysqli_stmt_attr_set(): (%s/%d): Not implemented in %s on line %d
|
Warning: mysqli_stmt_attr_set(): (%s/%d): Not implemented in %s on line %d
|
||||||
|
|
||||||
Warning: mysqli_kill(): processid should have positive value in %s on line %d
|
Warning: mysqli_kill(): processid should have positive value in %s on line %d
|
||||||
|
|
|
@ -1481,13 +1481,14 @@ MYSQLND_METHOD(mysqlnd_conn_data, next_result)(MYSQLND_CONN_DATA * const conn)
|
||||||
DBG_ENTER("mysqlnd_conn_data::next_result");
|
DBG_ENTER("mysqlnd_conn_data::next_result");
|
||||||
DBG_INF_FMT("conn=%llu", conn->thread_id);
|
DBG_INF_FMT("conn=%llu", conn->thread_id);
|
||||||
|
|
||||||
|
SET_EMPTY_ERROR(conn->error_info);
|
||||||
|
|
||||||
if (PASS == conn->m->local_tx_start(conn, this_func)) {
|
if (PASS == conn->m->local_tx_start(conn, this_func)) {
|
||||||
do {
|
do {
|
||||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_NEXT_RESULT_PENDING) {
|
if (GET_CONNECTION_STATE(&conn->state) != CONN_NEXT_RESULT_PENDING) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_EMPTY_ERROR(conn->error_info);
|
|
||||||
UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
|
UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
|
||||||
/*
|
/*
|
||||||
We are sure that there is a result set, since conn->state is set accordingly
|
We are sure that there is a result set, since conn->state is set accordingly
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue