php.net |  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
Votes:1
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: None
 [2003-08-13 16:17 UTC] jojoao at hotmail dot com
Description:
------------
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");
$row=odbc_fetch_array($re);
var_dump($row);

Expected result:
----------------
array(6) {
  [0]=>
  string(2) "99"
  ["first"]=>
  string(2) "99"
  [1]=>
  string(3) "100"
  [100]=>
  string(3) "100"
  [2]=>
  string(3) "101"
  [101]=>
  string(3) "101"
}

Actual result:
--------------
array(2) {
  ["first"]=>
  string(2) "99"
  [""]=>
  string(3) "101"
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-15 07:05 UTC] sniper@php.net
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 http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net 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);
var_dump(odbc_fetch_array($result));

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC