#36578 [NEW]: $stmt->fetch() on empty resultset does nothing
| From: | terry at bitsoup dot com | Date: | Wed, 01 Mar 2006 18:59:36 +0000 |
| Subject: | #36578 [NEW]: $stmt->fetch() on empty resultset does nothing | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-93813@lists.php.net to get a copy of this message | ||
From: terry at bitsoup dot com
Operating system: Windows XP
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: $stmt->fetch() on empty resultset does nothing
Description:
------------
A fetch against a statment that returns an empty resultset doesn't set any
PDO error information, nor does it raise an exception.
Testing against MySQL 5.0.18
Reproduce code:
---------------
Database connection is successful, and mode is set to throw exceptions:
try
{
$sth = $dbh->prepare("SELECT * from any_table where 1=2");
$sth->execute();
$row = $sth->fetch();
echo "ERROR=" . $sth->errorCode();
}
catch (PDOException $e)
{
dbg("DB Error!: " . $e->getMessage());
die();
}
Expected result:
----------------
Either
ERROR=20
when not using exceptions, or an exception.
Actual result:
--------------
ERROR=00
--
Edit bug report at http://bugs.php.net/?id=36578&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36578&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36578&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36578&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36578&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36578&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36578&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36578&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36578&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36578&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36578&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36578&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36578&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36578&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36578&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36578&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36578&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36578&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36578&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36578&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36578&r=mysqlcfg