php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39345 foreach($query as $row) gives PDO exception at ext\pdo_odbc\odbc_stmt.c:363
Submitted: 2006-11-02 16:12 UTC Modified: 2006-11-13 15:09 UTC
From: frederic dot fanchamps at skynet dot be Assigned:
Status: Closed Package: ODBC related
PHP Version: 5.1.6 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: frederic dot fanchamps at skynet dot be
New email:
PHP Version: OS:

 

 [2006-11-02 16:12 UTC] frederic dot fanchamps at skynet dot be
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-02 19:38 UTC] frederic dot fanchamps at skynet dot be
I have tried with PHP 5.2.1-dev (cli) (built: Oct 31 2006 08:22:42) and with this version the problem does not occur.
 [2006-11-13 15:09 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 07:01:32 2024 UTC