Skip to content

Commit 41a4379

Browse files
committed
Fix #41997: SP call yields additional empty result set
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.
1 parent 9c3b7cc commit 41a4379

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ PHP NEWS
1818
- ODBC:
1919
. Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
2020

21+
- PDO_MySQL:
22+
. Fixed bug #41997 (SP call yields additional empty result set). (cmb)
23+
2124
29 Aug 2019, PHP 7.2.22
2225

2326
- Core:

ext/pdo_mysql/mysql_statement.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,14 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
425425
pdo_mysql_error_stmt(stmt);
426426
PDO_DBG_RETURN(0);
427427
} else {
428-
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt));
428+
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt) && stmt->row_count);
429429
}
430430
#else
431431
if (mysql_next_result(H->server) > 0) {
432432
pdo_mysql_error_stmt(stmt);
433433
PDO_DBG_RETURN(0);
434434
} else {
435-
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt));
435+
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt) && stmt->row_count);
436436
}
437437
#endif
438438
}

ext/pdo_mysql/tests/bug_39858.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ if ($version < 50000)
1818
die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n",
1919
$matches[0], $matches[1], $matches[2], $version));
2020
?>
21-
--XFAIL--
22-
nextRowset() problem with stored proc & emulation mode & mysqlnd
2321
--FILE--
2422
<?php
2523
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');

ext/pdo_mysql/tests/bug_41997.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
PDO MySQL Bug #41997 (stored procedure call returning single rowset blocks future queries)
3-
--XFAIL--
4-
nextRowset() problem with stored proc & emulation mode & mysqlnd
53
--SKIPIF--
64
<?php
75
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');

ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
MySQL Prepared Statements and different column counts
3-
--XFAIL--
4-
nextRowset() problem with stored proc & emulation mode & mysqlnd
53
--SKIPIF--
64
<?php
75
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');

0 commit comments

Comments
 (0)