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