Bug #63185 [PATCH]: nextRowset() ignores MySQL errors with native prepared statements
| From: | Anonymous@Gmail.com | Date: | Fri, 26 Feb 2021 22:17:26 +0000 |
| Subject: | Bug #63185 [PATCH]: nextRowset() ignores MySQL errors with native prepared statements | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232408@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63185&edit=1
ID: 63185
Patch added by: Anonymous@Gmail.com
Reported by: dexen dot devries at gmail dot com
Summary: nextRowset() ignores MySQL errors with native
prepared statements
Status: Closed
Type: Bug
Package: PDO MySQL
Operating System: linux
PHP Version: 5.4.7
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Ignore externally managed and generated files
On GitHub: https://github.com/php/web-windows/pull/21
Patch: https://github.com/php/web-windows/pull/21.patch
Previous Comments:
------------------------------------------------------------------------
[2020-12-08 10:36:34] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=bd093ad8615267ae4ff1a237e6285dc182a9ff57
Log: Fixed bug #63185
------------------------------------------------------------------------
[2020-12-08 09:41:00] nikic@php.net
Looks like just reporting the error from next_result() doesn't cut, because the preceding
more_results() call already returns false in this case.
------------------------------------------------------------------------
[2020-12-08 09:21:28] nikic@php.net
I think for emulated prepares this was fixed in https://github.com/php/php-src/commit/0737be7e7baf1fece1683ca9f33064733d8b3514,
but for native prepared statements I can reproduce this on current master.
------------------------------------------------------------------------
[2013-11-22 14:48:39] dexen dot devries at gmail dot com
Another take on the bug, with a testcase: http://www.yiiframework.com/forum/index.php/topic/39970-transaction-and-multiple-queries/
------------------------------------------------------------------------
[2012-10-25 10:56:11] dexen dot devries at gmali dot com
To simplify OP: MySQL PDO with
mysqlnd' and with PDO::ATTR_EMULATE_PREPARES set to
false' triggers this bug -- errors returned along 2nd or later rowsets are ignored. For
example, when calling an SQL stored procedure which contains several SELECT statements, and thus
returns multiple rowsets.
Relevant C fragment, file ext/pdo_mysql/mysql_statement.c:
static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
{
(...)
#if PDO_USE_MYSQLND
if (!H->emulate_prepare) {
if (!mysqlnd_stmt_more_results(S->stmt)) {
PDO_DBG_RETURN(0);
}
if (mysqlnd_stmt_next_result(S->stmt)) {
/*** here error goes unnoticed ***/
PDO_DBG_RETURN(0);
}
Trivial patch attached.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63185
--
Edit this bug report at https://bugs.php.net/bug.php?id=63185&edit=1