xref: /PHP-5.3/ext/oci8/tests/bug44008.phpt (revision c7a8bd6a)
1--TEST--
2Bug #44008 (Incorrect usage of OCI-Lob->close crashes PHP)
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7?>
8--FILE--
9<?php
10
11require dirname(__FILE__).'/connect.inc';
12
13// Initialization
14
15$stmtarray = array(
16		"create or replace procedure bug44008_proc (p in out clob)
17		as begin p := 'A';
18		end;"
19);
20
21oci8_test_sql_execute($c, $stmtarray);
22
23// Run Test
24
25$s = oci_parse($c, 'begin bug44008_proc(:data); end;');
26$textLob = oci_new_descriptor($c, OCI_D_LOB);
27oci_bind_by_name($s, ":data", $textLob, -1, OCI_B_CLOB);
28oci_execute($s, OCI_DEFAULT);
29$r = $textLob->load();
30echo "$r\n";
31
32// Incorrectly closing the lob doesn't cause a crash.
33// OCI-LOB->close() is documented for use only with OCI-Lob->writeTemporary()
34$textLob->close();
35
36// Cleanup
37
38$stmtarray = array(
39        "drop procedure bug44008_proc"
40);
41
42oci8_test_sql_execute($c, $stmtarray);
43
44echo "Done\n";
45
46?>
47--EXPECT--
48A
49Done
50