]> granicus.if.org Git - php/commitdiff
MFH: fix #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
authorAntony Dovgal <tony2001@php.net>
Thu, 18 May 2006 13:21:08 +0000 (13:21 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 18 May 2006 13:21:08 +0000 (13:21 +0000)
NEWS
ext/oci8/oci8.c
ext/oci8/tests/fetch_array.phpt
ext/oci8/tests/field_funcs.phpt
ext/oci8/tests/field_funcs1.phpt
ext/oci8/tests/lob_011.phpt
ext/oci8/tests/select_null.phpt

diff --git a/NEWS b/NEWS
index 7f59796b70db4f2e9d4067b67b5d1a74ce61d92c..f73d5935b8047f7ec4137f13853c93df668c1885 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,8 @@ PHP                                                                        NEWS
 - Added pg_field_table() function. (Edin)
 - Added implementation of curl_multi_info_read(). (Brian)
 - Added RFC2397 (data: stream) support. (Marcus)
+- Fixed bug #37487 (oci_fetch_array() array-type should always default to
+  OCI_BOTH). (Tony)
 - Fixed bug #37395 (recursive mkdir() fails to create nonexistent directories 
   in root dir). (Tony)
 - Fixed bug #37457 (Crash when an exception is thrown in accept() method of 
index adb6fb298e0d75ea112b88a0cabebfa961c20dc9..06bfccfd4ed18551db0fc7167dcfbe191d980a19 100644 (file)
@@ -1643,6 +1643,16 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
                fetch_mode = mode;
        }
 
+       if (!(fetch_mode & PHP_OCI_NUM) && !(fetch_mode & PHP_OCI_ASSOC)) {
+               /* none of the modes present, use the default one */
+               if (mode & PHP_OCI_ASSOC) {
+                       fetch_mode |= PHP_OCI_ASSOC;
+               } 
+               if (mode & PHP_OCI_NUM) {
+                       fetch_mode |= PHP_OCI_NUM;
+               }
+       }
+
        PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
 
        if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
index 30782954260d7a3146f02802a8c323e917a1c74e..e2f32483d58a33116e019f85893bc995c1955f71 100644 (file)
@@ -209,58 +209,100 @@ array(4) {
   ["VALUE"]=>
   string(1) "1"
 }
-array(2) {
+array(4) {
   [0]=>
   string(1) "1"
+  ["ID"]=>
+  string(1) "1"
   [1]=>
   string(1) "1"
+  ["VALUE"]=>
+  string(1) "1"
 }
-array(2) {
+array(4) {
   [0]=>
   string(1) "1"
+  ["ID"]=>
+  string(1) "1"
   [1]=>
   string(1) "1"
+  ["VALUE"]=>
+  string(1) "1"
 }
-array(2) {
+array(4) {
   [0]=>
   string(1) "1"
+  ["ID"]=>
+  string(1) "1"
   [1]=>
   string(1) "1"
+  ["VALUE"]=>
+  string(1) "1"
 }
-array(5) {
+array(10) {
   [0]=>
   string(1) "1"
+  ["ID"]=>
+  string(1) "1"
   [1]=>
   string(1) "1"
+  ["VALUE"]=>
+  string(1) "1"
   [2]=>
   NULL
+  ["BLOB"]=>
+  NULL
   [3]=>
   NULL
+  ["CLOB"]=>
+  NULL
   [4]=>
   NULL
+  ["STRING"]=>
+  NULL
 }
-array(5) {
+array(10) {
   [0]=>
   string(1) "1"
+  ["ID"]=>
+  string(1) "1"
   [1]=>
   string(1) "1"
+  ["VALUE"]=>
+  string(1) "1"
   [2]=>
   NULL
+  ["BLOB"]=>
+  NULL
   [3]=>
   NULL
+  ["CLOB"]=>
+  NULL
   [4]=>
   NULL
+  ["STRING"]=>
+  NULL
 }
-array(5) {
+array(10) {
   [0]=>
   string(1) "1"
+  ["ID"]=>
+  string(1) "1"
   [1]=>
   string(1) "1"
+  ["VALUE"]=>
+  string(1) "1"
   [2]=>
   NULL
+  ["BLOB"]=>
+  NULL
   [3]=>
   NULL
+  ["CLOB"]=>
+  NULL
   [4]=>
   NULL
+  ["STRING"]=>
+  NULL
 }
 Done
index 72638226e32806fe7bac83ab1092c78712299af6..988e5f7a12af8b443a21e6110f4016c1ecd56438 100644 (file)
@@ -34,7 +34,7 @@ if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
 
-$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
 var_dump($row);
 
 foreach ($row as $num => $field) {
index 68986e051fef93ffd4f0ddba278938f913e7950b..b41e743e41047c8a6297edefe9eb0144487dab74 100644 (file)
@@ -34,7 +34,7 @@ if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
 
-$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
 var_dump($row);
 
 var_dump(oci_field_is_null($s, -1));
index 2dd78985f93751b90b3f92a1234d6f789523ce52..b074e1730ef7c897737de6e5c4bfb65c0b81a081 100644 (file)
@@ -69,8 +69,10 @@ echo "Done\n";
 int(32)
 bool(true)
 string(32) "some string here. string, I said"
-array(1) {
+array(2) {
   [0]=>
   string(32) "some string here. string, I said"
+  ["BLOB"]=>
+  string(32) "some string here. string, I said"
 }
 Done
index 20307b3e299f3c77e26c5e6b24365503455e47c3..87c5b815fd242f496f0c25c02d49ce1cfb8ec0f5 100644 (file)
@@ -16,8 +16,10 @@ var_dump(oci_fetch_array($stmt, OCI_RETURN_NULLS));
 echo "Done\n";
 ?>
 --EXPECT--     
-array(1) {
+array(2) {
   [0]=>
   NULL
+  ["NULL"]=>
+  NULL
 }
 Done