Skip to content

Commit 0044a81

Browse files
committed
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.
1 parent dd97cb1 commit 0044a81

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

ext/pdo_mysql/mysql_statement.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,7 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori
668668
#endif /* PDO_USE_MYSQLND */
669669

670670
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
671-
#if PDO_USE_MYSQLND
672-
if (S->result->unbuf && !S->result->unbuf->eof_reached && mysql_errno(S->H->server)) {
673-
#else
674-
if (!S->result->eof && mysql_errno(S->H->server)) {
675-
#endif
671+
if (!S->H->buffered && mysql_errno(S->H->server)) {
676672
pdo_mysql_error_stmt(stmt);
677673
}
678674
PDO_DBG_RETURN(0);

0 commit comments

Comments
 (0)