php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37487 oci_fetch_array() array-type should always default to OCI_BOTH
Submitted: 2006-05-18 04:32 UTC Modified: 2006-05-18 13:21 UTC
From: cjbj at hotmail dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5.1.4 OS: n/a
Private report: No CVE-ID: None
 [2006-05-18 04:32 UTC] cjbj at hotmail dot com
Description:
------------
The array type for oci_fetch_array() should always default to OCI_BOTH
unless explicitly changed.  For example, currently
  oci_fetch_array($s)
is equivalent to
  oci_fetch_array($s, OCI_BOTH)

I'm saying that
  oci_fetch_array($s, OCI_RETURN_NULLS)
should be equivalent to
  oci_fetch_array($s, OCI_RETURN_NULLS+OCI_BOTH)
At the moment it is equivalent to
  oci_fetch_array($s, OCI_RETURN_NULLS+OCI_NUM)
which is (i) not documented (ii) harder to understand and document.


Reproduce code:
---------------
<?php
$c = oci_connect("hr", "hr", "//localhost/XE");
$s = oci_parse($c, "select * from dual");
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_RETURN_NULLS)) {
  echo "<pre>"; var_dump($res); echo "</pre>";
}
oci_execute($s);
while ($res = oci_fetch_array($s)) {
  echo "<pre>"; var_dump($res); echo "</pre>";
}
  oci_close($c);
?>

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

  array(2) {
    [0]=>
    string(1) "X"
    ["DUMMY"]=>
    string(1) "X"
  }

Actual result:
--------------
  array(1) {
    [0]=>
    string(1) "X"
  }

  array(2) {
    [0]=>
    string(1) "X"
    ["DUMMY"]=>
    string(1) "X"
  }


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-18 13:21 UTC] tony2001@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: Sun Dec 22 05:01:30 2024 UTC