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