Bug #54978 [Fbk->NoF]: mysql_query() returns true with a SELECT statement
Edit report at https://bugs.php.net/bug.php?id=54978&edit=1
ID: 54978
Updated by: php-bugs@lists.php.net
Reported by: radu dot dineiu at gmail dot com
Summary: mysql_query() returns true with a SELECT statement
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: MySQL related
Operating System: Any
PHP Version: 5.3.6
Assigned To: mysql
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2011-07-24 03:57:27] radu dot dineiu at gmail dot com
Yes, this happens with PHP's mysql_* functions using libmysqlclient, not mysqlnd.
I don't know if it happens with mysqlnd as well, I couldn't test that, and now I
can't get the same environment again.
------------------------------------------------------------------------
[2011-07-20 10:55:15] uw@php.net
Are you using libmysql, if so, which version? Can you reproduce with mysqlnd?
And, yes, looks like we need the patch. I wonder if its libmysql version dependent.
Thanks!
------------------------------------------------------------------------
[2011-06-02 17:38:28] radu dot dineiu at gmail dot com
Description:
------------
This doesn't happen often, but it does happen sometimes when the database server
interrupts the connection during a query. Seems to be related to the fact that
libmysqlclient's mysql_query() may return success, even if an error occurred, as
described at:
http://dev.mysql.com/doc/refman/5.5/en/null-mysql-store-result.html
Test script:
---------------
$resource = mysql_query('SELECT test FROM test');
if ($resource === true) {
throw new Exception('mysql_query() returned true for SELECT');
}
Expected result:
----------------
An exception should not be thrown, because the documentation for mysql_query() at
php.net clearly states that a SELECT query will only ever return false or a
resource.
Actual result:
--------------
An exception is thrown, because mysql_query() returns true with a SELECT query.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54978&edit=1
Thread (4 messages)