xref: /PHP-8.3/ext/oci8/tests/bug47189.phpt (revision a53e5617)
1--TEST--
2Bug #47189 (Multiple oci_fetch_all calls)
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs: different error handling for this undefined behavior
9require __DIR__.'/skipif.inc';
10?>
11--FILE--
12<?php
13
14require __DIR__.'/connect.inc';
15
16echo "Test 1\n";
17
18$s = oci_parse($c, "select * from dual");
19oci_execute($s);
20oci_fetch_all($s, $rs, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
21var_dump($rs);
22oci_fetch_all($s, $rs1, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
23var_dump($rs1);
24
25echo "Test 2\n";
26
27$s = oci_parse($c, "select * from dual");
28oci_execute($s);
29oci_fetch_all($s, $rs, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
30var_dump($rs);
31oci_fetch_all($s, $rs1, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
32var_dump($rs1);
33
34?>
35--EXPECTF--
36Test 1
37array(1) {
38  [0]=>
39  array(1) {
40    ["DUMMY"]=>
41    string(1) "X"
42  }
43}
44array(0) {
45}
46Test 2
47array(1) {
48  [0]=>
49  array(1) {
50    ["DUMMY"]=>
51    string(1) "X"
52  }
53}
54
55Warning: oci_fetch_all(): ORA-01002: %s in %s on line %d
56array(0) {
57}
58