1--TEST-- 2Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached) 3--SKIPIF-- 4<?php 5$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 6require(dirname(__FILE__).'/skipif.inc'); 7if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 8?> 9--FILE-- 10<?php 11 12require dirname(__FILE__).'/connect.inc'; 13 14// Initialization 15 16$stmtarray = array( 17 "DROP table bug42496_1_tab", 18 "CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)", 19 "INSERT INTO bug42496_1_tab VALUES('test1', 'test1')", 20 "INSERT INTO bug42496_1_tab VALUES('test2', 'test2')", 21 "INSERT INTO bug42496_1_tab VALUES('test3', 'test3')" 22); 23 24oci8_test_sql_execute($c, $stmtarray); 25 26// Run Test 27 28echo "Test 1\n"; 29 30for ($i = 0; $i < 15000; $i++) { 31 $s = oci_parse($c, "SELECT * from bug42496_1_tab"); 32 oci_define_by_name($s, "C1", $col1); 33 oci_define_by_name($s, "C2", $col2); 34 if (oci_execute($s)) { 35 $arr = array(); 36 while ($arr = oci_fetch_assoc($s)) { 37 $arr['C1']->free(); 38 $arr['C2']->free(); 39 } 40 } 41 oci_free_statement($s); 42} 43 44echo "Done\n"; 45 46// Cleanup 47 48$stmtarray = array( 49 "DROP table bug42496_1_tab" 50); 51 52oci8_test_sql_execute($c, $stmtarray); 53 54?> 55--EXPECT-- 56Test 1 57Done 58