1--TEST--
2oci_execute() segfault after repeated bind of LOB descriptor
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';
12require dirname(__FILE__).'/create_table.inc';
13
14$ora_sql = "INSERT INTO
15                       ".$schema.$table_name." (blob, clob)
16                      VALUES (empty_blob(), empty_clob())
17                      RETURNING
18                               blob
19                      INTO :v_blob ";
20
21$s = oci_parse($c, $ora_sql);
22$blob = oci_new_descriptor($c, OCI_D_LOB);
23oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB);
24oci_execute($s, OCI_DEFAULT);
25var_dump($blob->save("some binary data"));
26
27oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB);
28oci_execute($s, OCI_DEFAULT);
29var_dump($blob->save("some more binary data"));
30
31$query = 'SELECT blob, DBMS_LOB.GETLENGTH(blob) FROM '.$schema.$table_name.' ORDER BY 2';
32
33$s = oci_parse ($c, $query);
34oci_execute($s, OCI_DEFAULT);
35
36while ($arr = oci_fetch_assoc($s)) {
37    $result = $arr['BLOB']->load();
38    var_dump($result);
39}
40
41require dirname(__FILE__).'/drop_table.inc';
42
43echo "Done\n";
44
45?>
46--EXPECT--
47bool(true)
48bool(true)
49string(16) "some binary data"
50string(21) "some more binary data"
51Done
52