Skip to content

Commit d001682

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fixed bug #81494
2 parents 7af0bf4 + df940a6 commit d001682

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

ext/mysqli/mysqli.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,17 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
10821082
}
10831083
#else
10841084
mysqlnd_fetch_into(result, ((fetchtype & MYSQLI_NUM)? MYSQLND_FETCH_NUM:0) | ((fetchtype & MYSQLI_ASSOC)? MYSQLND_FETCH_ASSOC:0), return_value);
1085+
/* TODO: We don't have access to the connection object at this point, so we use low-level
1086+
* mysqlnd APIs to access the error information. We should try to pass through the connection
1087+
* object instead. */
1088+
if (MyG(report_mode) & MYSQLI_REPORT_ERROR) {
1089+
MYSQLND_CONN_DATA *conn = result->conn;
1090+
unsigned error_no = conn->m->get_error_no(conn);
1091+
if (error_no) {
1092+
php_mysqli_report_error(
1093+
conn->m->get_sqlstate(conn), error_no, conn->m->get_error_str(conn));
1094+
}
1095+
}
10851096
#endif
10861097
}
10871098
/* }}} */

ext/mysqli/tests/bug64726.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ require_once('skipifconnectfailure.inc');
1515
require 'connect.inc';
1616
$db = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
1717

18+
mysqli_report(MYSQLI_REPORT_ERROR);
1819
$result = $db->query('SELECT 1', MYSQLI_USE_RESULT);
1920
$db->close();
2021
var_dump($result->fetch_object());
2122
?>
2223
--EXPECTF--
23-
Warning: mysqli_result::fetch_object(): Error while reading a row in %sbug64726.php on line %d
24+
Warning: mysqli_result::fetch_object(): (HY000/2014): Commands out of sync; you can't run this command now in %s on line %d
2425
bool(false)

ext/mysqli/tests/bug79375.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,4 @@ Lock wait timeout exceeded; try restarting transaction
169169
Running query on first connection
170170
Got 1 for first connection
171171
Running query on second connection
172-
173-
Warning: mysqli_result::fetch_row(): Error while reading a row in %s on line %d
174-
Got 0 for second connection
172+
Lock wait timeout exceeded; try restarting transaction

ext/mysqlnd/mysqlnd_result.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned int
970970

971971
DBG_ENTER("mysqlnd_res::fetch_into");
972972
if (FAIL == result->m.fetch_row(result, &row_data, flags, &fetched_anything)) {
973-
php_error_docref(NULL, E_WARNING, "Error while reading a row");
974973
RETVAL_FALSE;
975974
DBG_VOID_RETURN;
976975
} else if (fetched_anything == FALSE) {

0 commit comments

Comments
 (0)