|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57432 PDO_ODBC: Wrong indexes for returned row
Submitted: 2006-12-15 07:37 UTC Modified: 2015-09-20 04:22 UTC
From: rysenko at gmail dot com Assigned:
Status: No Feedback Package: PDO ODBC
PHP Version: 5.2.0 RC4 OS: Windows XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-12-15 07:37 UTC] rysenko at gmail dot com
I'm doing a simple count query against catalogued DB2 database through PDO. By default PDO::FETCH_BOTH mode is used and I expect to see result in 0 index of the fetched row, but it appears in indexes 1 and 2. Same occurs with queries like "SELECT 1+1 FROM arcticles". This only occurs on DB2 through PDO, and doesn't occur on MySQL through PDO, DB2 through ibm_db2 or DB2 through ODBC. So I consider this to be  a bug in PDO.

Reproduce code:
$conn = new PDO('odbc:CATNAME', 'user', 'pass');
$sql = 'SELECT COUNT(*) FROM articles';
foreach ($conn->query($sql) as $row) {

Expected result:
array(2) { [0]=>  string(1) "7"}

or maybe

array(2) { ["COUNT(*)"]=>  string(1) "7" [0]=>  string(1) "7"}

like in MySQL through PDO

Actual result:
array(2) { [1]=>  string(1) "7" [2]=>  string(1) "7" }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-12 02:12 UTC]
-Summary: Wrong indexes for returned row +Summary: PDO_ODBC: Wrong indexes for returned row -Package: PDO +Package: PDO related
 [2014-01-01 12:43 UTC]
-Package: PDO related +Package: PDO ODBC
 [2015-09-08 22:14 UTC]
-Status: Open +Status: Feedback
 [2015-09-08 22:14 UTC]
Is that still an issue with recent PHP versions?
 [2015-09-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Jun 07 22:03:40 2023 UTC