PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #37487 oci_fetch_array() array-type should always default to OCI_BOTH
Submitted:18 May 2006 4:32am UTC Modified: 18 May 2006 1:21pm UTC
From:cjbj at hotmail dot com Assigned to:
Status:Closed Category:OCI8 related
Version:5.1.4 OS:n/a
View/Vote Developer Edit Submission

[18 May 2006 4:32am 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"
  }

[18 May 2006 1:21pm 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.


RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC