From: Operating system: Any PHP version: 5.3.6 Package: MySQL related Bug Type: Bug Bug description:mysql_query() returns true with a SELECT statement
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 bug report at http://bugs.php.net/bug.php?id=54978&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54978&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54978&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54978&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54978&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54978&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54978&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54978&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54978&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54978&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54978&r=support Expected behavior: http://bugs.php.net/fix.php?id=54978&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54978&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54978&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54978&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54978&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54978&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54978&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54978&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54978&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54978&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54978&r=mysqlcfg
