xref: /PHP-7.4/ext/oci8/tests/bug44206.phpt (revision 26dfce7f)
1--TEST--
2Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(__DIR__.'/skipif.inc');
7?>
8--FILE--
9<?php
10
11require __DIR__.'/connect.inc';
12
13// Run Test
14
15for ($x = 0; $x < 400; $x++)
16{
17	$stmt = "select cursor (select $x from dual) a,
18		 cursor (select $x from dual) b
19		 from dual";
20	$s = oci_parse($c, $stmt);
21	$r = oci_execute($s);
22        if (!$r) {
23                echo "Exiting $x\n";
24                exit;
25        }
26	$mode = OCI_ASSOC | OCI_RETURN_NULLS;
27	$result = oci_fetch_array($s, $mode);
28	oci_execute($result['A']);
29	oci_execute($result['B']);
30	oci_fetch_array($result['A'], $mode);
31	oci_fetch_array($result['B'], $mode);
32	oci_free_statement($result['A']);
33	oci_free_statement($result['B']);
34	oci_free_statement($s);
35}
36
37echo "Completed $x\n";
38
39oci_close($c);
40
41echo "Done\n";
42
43?>
44--EXPECT--
45Completed 400
46Done
47