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