]> granicus.if.org Git - php/commitdiff
Fix #41997: SP call yields additional empty result set
authorChristoph M. Becker <cmbecker69@gmx.de>
Tue, 6 Aug 2019 12:30:41 +0000 (14:30 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Tue, 3 Sep 2019 11:29:30 +0000 (13:29 +0200)
When stored procedures are called, the "final result set is a status
result that includes no result set".  Calling `::nextRowset()` on the
actual last result set should return FALSE, since there is actually no
further result set to be processed.

NEWS
ext/pdo_mysql/mysql_statement.c
ext/pdo_mysql/tests/bug_39858.phpt
ext/pdo_mysql/tests/bug_41997.phpt
ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt

diff --git a/NEWS b/NEWS
index 8ededb077d41bed3e62c6a17ad02f7b3bb8b9fff..2580bda506065fac256509405343bc0342c827f0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@ PHP                                                                        NEWS
 - ODBC:
   . Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
 
+- PDO_MySQL:
+  . Fixed bug #41997 (SP call yields additional empty result set). (cmb)
+
 29 Aug 2019, PHP 7.2.22
 
 - Core:
index e230cfbf05a5da8e289e576b43b053c5f77bf2f9..950aa64f074b17587a01fdae499dc36957103408 100644 (file)
@@ -425,14 +425,14 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
                pdo_mysql_error_stmt(stmt);
                PDO_DBG_RETURN(0);
        } else {
-               PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt));
+               PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt) && stmt->row_count);
        }
 #else
        if (mysql_next_result(H->server) > 0) {
                pdo_mysql_error_stmt(stmt);
                PDO_DBG_RETURN(0);
        } else {
-               PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt));
+               PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt) && stmt->row_count);
        }
 #endif
 }
index 896519f8ab0278c26575f7d4baa59d29fe57db3f..aaf0f3e9f99d3720e7a8b06f83d2c557f610a051 100644 (file)
@@ -18,8 +18,6 @@ if ($version < 50000)
        die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n",
                $matches[0], $matches[1], $matches[2], $version));
 ?>
---XFAIL--
-nextRowset() problem with stored proc & emulation mode & mysqlnd
 --FILE--
 <?php
 require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
index f001eec7d032ae9da9fbbba4efdb87b3d2625f09..69ba9e7c4cf1ab9e46ccbb32037d17967a7f2c00 100644 (file)
@@ -1,7 +1,5 @@
 --TEST--
 PDO MySQL Bug #41997 (stored procedure call returning single rowset blocks future queries)
---XFAIL--
-nextRowset() problem with stored proc & emulation mode & mysqlnd
 --SKIPIF--
 <?php
 require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
index e58d4a657821cfbc66818a665f7f8f1aba75c66f..94544e2120a5de773ad27e502d41dccd89ec66cb 100644 (file)
@@ -1,7 +1,5 @@
 --TEST--
 MySQL Prepared Statements and different column counts
---XFAIL--
-nextRowset() problem with stored proc & emulation mode & mysqlnd
 --SKIPIF--
 <?php
 require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');