Bug #54978 [NEW]: mysql_query() returns true with a SELECT statement
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
Thread (4 messages)
- radu dot dineiu at gmail dot com