bug42496_1.phpt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_1_tab",
  17. "CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)",
  18. "INSERT INTO bug42496_1_tab VALUES('test1', 'test1')",
  19. "INSERT INTO bug42496_1_tab VALUES('test2', 'test2')",
  20. "INSERT INTO bug42496_1_tab VALUES('test3', 'test3')"
  21. );
  22. oci8_test_sql_execute($c, $stmtarray);
  23. // Run Test
  24. echo "Test 1\n";
  25. for ($i = 0; $i < 15000; $i++) {
  26. $s = oci_parse($c, "SELECT * from bug42496_1_tab");
  27. oci_define_by_name($s, "C1", $col1);
  28. oci_define_by_name($s, "C2", $col2);
  29. if (oci_execute($s)) {
  30. $arr = array();
  31. while ($arr = oci_fetch_assoc($s)) {
  32. $arr['C1']->free();
  33. $arr['C2']->free();
  34. }
  35. }
  36. oci_free_statement($s);
  37. }
  38. echo "Done\n";
  39. // Cleanup
  40. $stmtarray = array(
  41. "DROP table bug42496_1_tab"
  42. );
  43. oci8_test_sql_execute($c, $stmtarray);
  44. ?>
  45. --EXPECT--
  46. Test 1
  47. Done