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