php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62820 mysqlnd API incompatability breaks PDOStatement->nextRowset()
Submitted: 2012-08-14 18:28 UTC Modified: 2020-12-09 15:49 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nikic@php.net Assigned: nikic (profile)
Status: Closed Package: PDO MySQL
PHP Version: master-Git-2012-08-14 (Git) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
42 + 44 = ?
Subscribe to this entry?

 
 [2012-08-14 18:28 UTC] nikic@php.net
Description:
------------
When the mysqlnd driver is used PDOStatement->nextRowset() does not return bool(false) when there are no more result sets. This causes several test 
failures, which all have a diff looking similar to this:

    008+
    009+ Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error in %s/bug_41997.php on line 11
    010+ array(0) {
    011+ }

This can be traced down to mysql_next_result() returning 0 instead of -1 in http://lxr.php.net/xref/PHP_TRUNK/ext/pdo_mysql/mysql_statement.c#415.

The reason is that (when using mysqlnd) mysql_next_result is aliased to mysqlnd_next_result, but both have different APIs: The mysqlnd_ version only returns PASS = 0 or FAIL = 1, whereas the mysql_ version returns -1 if the call worked, but there were no more resultsets.

This is documented at http://dev.mysql.com/doc/refman/5.0/en/mysql-next-result.html in the "Return Values" section. The default mysqlnd next_result implementation is here: http://lxr.php.net/xref/PHP_TRUNK/ext/mysqlnd/mysqlnd.c#2100.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-14 18:29 UTC] nikic@php.net
Related bug report: https://bugs.php.net/bug.php?id=62803
 [2012-09-11 13:46 UTC] tyrael@php.net
-Assigned To: +Assigned To: mysql
 [2013-03-24 15:38 UTC] nikic@php.net
Just looked at the code again, what I said above is wrong. The code checks mysql_more_results() before (http://lxr.php.net/xref/PHP_TRUNK/ext/pdo_mysql/mysql_statement.c#414), so it should not be related to the return value of mysql_next_result(). Something else is wrong.
 [2014-01-01 12:36 UTC] felipe@php.net
-Package: PDO related +Package: PDO MySQL
 [2017-10-24 08:07 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: mysql +Assigned To:
 [2020-12-09 15:49 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-12-09 15:49 UTC] nikic@php.net
The original hypothesis here was incorrect, and various rowset handling issues have recently been fixed, so I think it's safe to close this one.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC