1--TEST--
2oci_execute() segfault after repeated bind of LOB descriptor
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
8require(__DIR__.'/skipif.inc');
9?>
10--FILE--
11<?php
12
13require __DIR__.'/connect.inc';
14require __DIR__.'/create_table.inc';
15
16$ora_sql = "INSERT INTO
17                       ".$schema.$table_name." (blob, clob)
18                      VALUES (empty_blob(), empty_clob())
19                      RETURNING
20                               blob
21                      INTO :v_blob ";
22
23$s = oci_parse($c, $ora_sql);
24$blob = oci_new_descriptor($c, OCI_D_LOB);
25oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB);
26oci_execute($s, OCI_DEFAULT);
27var_dump($blob->save("some binary data"));
28
29oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB);
30oci_execute($s, OCI_DEFAULT);
31var_dump($blob->save("some more binary data"));
32
33$query = 'SELECT blob, DBMS_LOB.GETLENGTH(blob) FROM '.$schema.$table_name.' ORDER BY 2';
34
35$s = oci_parse ($c, $query);
36oci_execute($s, OCI_DEFAULT);
37
38while ($arr = oci_fetch_assoc($s)) {
39    $result = $arr['BLOB']->load();
40    var_dump($result);
41}
42
43require __DIR__.'/drop_table.inc';
44
45echo "Done\n";
46
47?>
48--EXPECT--
49bool(true)
50bool(true)
51string(16) "some binary data"
52string(21) "some more binary data"
53Done
54