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