xref: /PHP-8.3/ext/oci8/tests/bug45458.phpt (revision a53e5617)
1--TEST--
2Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly)
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11
12require __DIR__.'/connect.inc';
13
14// Run Test
15
16echo "Test 1\n";
17
18$stmt = 'select dummy "A", dummy "20" from dual';
19
20$s = oci_parse($c, $stmt);
21oci_execute($s);
22$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
23var_dump($data);
24var_dump($data[0]);
25var_dump($data[0]["A"]);
26var_dump($data[0]["20"]);
27oci_free_statement($s);
28
29echo "Test 2\n";
30
31$s = oci_parse($c, $stmt);
32oci_execute($s);
33$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
34var_dump($data);
35var_dump($data["A"]);
36var_dump($data["20"]);
37var_dump($data["A"][0]);
38var_dump($data["20"][0]);
39oci_free_statement($s);
40
41oci_close($c);
42
43?>
44--EXPECT--
45Test 1
46array(1) {
47  [0]=>
48  array(2) {
49    ["A"]=>
50    string(1) "X"
51    [20]=>
52    string(1) "X"
53  }
54}
55array(2) {
56  ["A"]=>
57  string(1) "X"
58  [20]=>
59  string(1) "X"
60}
61string(1) "X"
62string(1) "X"
63Test 2
64array(2) {
65  ["A"]=>
66  array(1) {
67    [0]=>
68    string(1) "X"
69  }
70  [20]=>
71  array(1) {
72    [0]=>
73    string(1) "X"
74  }
75}
76array(1) {
77  [0]=>
78  string(1) "X"
79}
80array(1) {
81  [0]=>
82  string(1) "X"
83}
84string(1) "X"
85string(1) "X"
86