From: frederic dot fanchamps at skynet dot be
Operating system: Windows XP
PHP version: 5.1.6
PHP Bug Type: ODBC related
Bug description: foreach($query as $row) gives PDO exception at
ext\pdo_odbc\odbc_stmt.c:363
Description:
------------
foreach($query as $row), $query coming from PDO, gives PDO exception at
ext\pdo_odbc\odbc_stmt.c:363 after reading the last row
Reproduce code:
---------------
<?php
$d = new PDO('odbc:localdb2', 'frf', 'password');
$d->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
foreach ($d->query('select * from employee') as $row) {
/* some code, or not, does not matter */
}
?>
Expected result:
----------------
no exception in the foreach
Actual result:
--------------
After reading the last row,
PHP Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[]: <<Unknown error>>: 0 (SQLFetchScroll[0] at
ext\pdo_odbc\odbc_stmt.c:363)' in C:\_work\test.php:5
Stack trace:
#0 C:\_work\test.php(5): unknown()
#1 {main}
thrown in C:\_work\test.php on line 5
--
Edit bug report at http://bugs.php.net/?id=39345&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39345&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39345&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39345&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39345&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39345&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39345&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39345&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39345&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39345&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39345&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39345&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39345&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39345&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39345&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39345&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39345&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39345&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39345&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39345&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39345&r=mysqlcfg