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