summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-05-18 13:21:08 +0000
committerAntony Dovgal <tony2001@php.net>2006-05-18 13:21:08 +0000
commit749f4ac2ab56290317f0020010e2e558196bde10 (patch)
tree18e35089dfbb19b0ff4c5c5e8658f6479ed7d583
parent557b7fbec584389203ff2b2d472893dfa493e2ad (diff)
downloadphp-git-749f4ac2ab56290317f0020010e2e558196bde10.tar.gz
MFH: fix #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
-rw-r--r--NEWS2
-rw-r--r--ext/oci8/oci8.c10
-rw-r--r--ext/oci8/tests/fetch_array.phpt54
-rw-r--r--ext/oci8/tests/field_funcs.phpt2
-rw-r--r--ext/oci8/tests/field_funcs1.phpt2
-rw-r--r--ext/oci8/tests/lob_011.phpt4
-rw-r--r--ext/oci8/tests/select_null.phpt4
7 files changed, 68 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 7f59796b70..f73d5935b8 100644
--- 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
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index adb6fb298e..06bfccfd4e 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -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)) {
diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt
index 3078295426..e2f32483d5 100644
--- a/ext/oci8/tests/fetch_array.phpt
+++ b/ext/oci8/tests/fetch_array.phpt
@@ -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
diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt
index 72638226e3..988e5f7a12 100644
--- a/ext/oci8/tests/field_funcs.phpt
+++ b/ext/oci8/tests/field_funcs.phpt
@@ -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) {
diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt
index 68986e051f..b41e743e41 100644
--- a/ext/oci8/tests/field_funcs1.phpt
+++ b/ext/oci8/tests/field_funcs1.phpt
@@ -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));
diff --git a/ext/oci8/tests/lob_011.phpt b/ext/oci8/tests/lob_011.phpt
index 2dd78985f9..b074e1730e 100644
--- a/ext/oci8/tests/lob_011.phpt
+++ b/ext/oci8/tests/lob_011.phpt
@@ -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
diff --git a/ext/oci8/tests/select_null.phpt b/ext/oci8/tests/select_null.phpt
index 20307b3e29..87c5b815fd 100644
--- a/ext/oci8/tests/select_null.phpt
+++ b/ext/oci8/tests/select_null.phpt
@@ -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