|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25081 odbc_fetch_array doesn't return numeric field
Submitted: 2003-08-13 16:17 UTC Modified: 2003-08-15 07:05 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jojoao at hotmail dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.3.3RC3 OS: Windows 2000
Private report: No CVE-ID:
 [2003-08-13 16:17 UTC] jojoao at hotmail dot com
It seems like odbc_fetch_array doesn't return numeric fields propely like others *_fetch_array does. This may cause alot of trouble.

Reproduce code:
$re = odbc_exec($id_mssql,"select 99 as first,100,101");

Expected result:
array(6) {
  string(2) "99"
  string(2) "99"
  string(3) "100"
  string(3) "100"
  string(3) "101"
  string(3) "101"

Actual result:
array(2) {
  string(2) "99"
  string(3) "101"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-15 07:05 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

 [2003-08-20 18:20 UTC] gms08701 at yahoo dot com
According to the manual, it states, "Fetch a result row as an associative array".
So is it supposed to also return numerical arrays like the other *_fetch_array() functions do?
I just tried Version 4.3.3RC5-dev (Aug 20 2003 22:11:08) from snaps, and it still is returning just an associative array.

$sql = 'SELECT versionnumber FROM sysibm.sysversions FOR READ ONLY';
$result = odbc_result($conn, $sql);

produces: array(1) { ["VERSIONNUMBER"]=>  string(7) "8010300" }

This isn't meant to open back the bug.  Im not sure if the function is supposed to return an associative array only, or an associative/numeric array.
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 00:01:40 2015 UTC