bug42496_2.phpt 1.2 KB

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