summaryrefslogtreecommitdiff
path: root/ext/oci8/tests/bug45458.phpt
blob: 3a4b514857b1f4d1eca1b8be23075bd290de286d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--TEST--
Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
--FILE--
<?php

require(__DIR__.'/connect.inc');

// Run Test

echo "Test 1\n";

$stmt = 'select dummy "A", dummy "20" from dual';

$s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($data);
var_dump($data[0]);
var_dump($data[0]["A"]);
var_dump($data[0]["20"]);
oci_free_statement($s);

echo "Test 2\n";

$s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
var_dump($data);
var_dump($data["A"]);
var_dump($data["20"]);
var_dump($data["A"][0]);
var_dump($data["20"][0]);
oci_free_statement($s);

oci_close($c);

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
  [0]=>
  array(2) {
    ["A"]=>
    string(1) "X"
    [20]=>
    string(1) "X"
  }
}
array(2) {
  ["A"]=>
  string(1) "X"
  [20]=>
  string(1) "X"
}
string(1) "X"
string(1) "X"
Test 2
array(2) {
  ["A"]=>
  array(1) {
    [0]=>
    string(1) "X"
  }
  [20]=>
  array(1) {
    [0]=>
    string(1) "X"
  }
}
array(1) {
  [0]=>
  string(1) "X"
}
array(1) {
  [0]=>
  string(1) "X"
}
string(1) "X"
string(1) "X"
===DONE===