bug44008.phpt 1010 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Bug #44008 (Incorrect usage of OCILob->close crashes PHP)
  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. ?>
  10. --FILE--
  11. <?php
  12. require __DIR__.'/connect.inc';
  13. // Initialization
  14. $stmtarray = array(
  15. "create or replace procedure bug44008_proc (p in out clob)
  16. as begin p := 'A';
  17. end;"
  18. );
  19. oci8_test_sql_execute($c, $stmtarray);
  20. // Run Test
  21. $s = oci_parse($c, 'begin bug44008_proc(:data); end;');
  22. $textLob = oci_new_descriptor($c, OCI_D_LOB);
  23. oci_bind_by_name($s, ":data", $textLob, -1, OCI_B_CLOB);
  24. oci_execute($s, OCI_DEFAULT);
  25. $r = $textLob->load();
  26. echo "$r\n";
  27. // Incorrectly closing the lob doesn't cause a crash.
  28. // OCI-LOB->close() is documented for use only with OCILob->writeTemporary()
  29. $textLob->close();
  30. // Cleanup
  31. $stmtarray = array(
  32. "drop procedure bug44008_proc"
  33. );
  34. oci8_test_sql_execute($c, $stmtarray);
  35. echo "Done\n";
  36. ?>
  37. --EXPECT--
  38. A
  39. Done