summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/mysql_statement.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-29 14:07:08 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-10-29 14:17:29 +0100
commit0044a81fbbe0807158a626c4c5a4d8f4d379247f (patch)
tree3708729bd2758e93db58b913a31aaccabc6e4239 /ext/pdo_mysql/mysql_statement.c
parentdd97cb1665fbcc57a966a1d5a356a4eff9743f63 (diff)
downloadphp-git-0044a81fbbe0807158a626c4c5a4d8f4d379247f.tar.gz
Handle errors during PDO row fetch
The EOF flag also gets set on error, so we always end up ignoring errors here. However, we should only check errors for unbuffered results. For buffered results, this function is guaranteed not to error, and querying the errno may return an unrelated error.
Diffstat (limited to 'ext/pdo_mysql/mysql_statement.c')
-rw-r--r--ext/pdo_mysql/mysql_statement.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index f3811abfe6..dbac374171 100644
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -668,11 +668,7 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori
#endif /* PDO_USE_MYSQLND */
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
-#if PDO_USE_MYSQLND
- if (S->result->unbuf && !S->result->unbuf->eof_reached && mysql_errno(S->H->server)) {
-#else
- if (!S->result->eof && mysql_errno(S->H->server)) {
-#endif
+ if (!S->H->buffered && mysql_errno(S->H->server)) {
pdo_mysql_error_stmt(stmt);
}
PDO_DBG_RETURN(0);