com php-src: Handle errors during PDO row fetch: ext/pdo_mysq l/mysql_statement.c

From: Date: Thu, 29 Oct 2020 13:17:29 +0000
Subject: com php-src: Handle errors during PDO row fetch: ext/pdo_mysq l/mysql_statement.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-113984@lists.php.net to get a copy of this message
Commit: 0044a81fbbe0807158a626c4c5a4d8f4d379247f Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 29 Oct 2020 14:07:08 +0100 Parents: dd97cb1665fbcc57a966a1d5a356a4eff9743f63 Branches: PHP-7.4 PHP-8.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0044a81fbbe0807158a626c4c5a4d8f4d379247f Log: 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. Changed paths: M ext/pdo_mysql/mysql_statement.c Diff: diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index f3811abfe60..dbac3741710 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);

« previous php.cvs (#113984) next »