1--TEST--
2PECL PDO_OCI Bug #6364 (segmentation fault on stored procedure call with OUT binds)
3--EXTENSIONS--
4pdo
5pdo_oci
6--SKIPIF--
7<?php
8if (getenv('SKIP_ASAN')) die('skip leaks memory under asan');
9require(__DIR__.'/../../pdo/tests/pdo_test.inc');
10PDOTest::skip();
11?>
12--FILE--
13<?php
14
15require __DIR__ . '/../../pdo/tests/pdo_test.inc';
16$dbh = PDOTest::factory();
17
18@$dbh->exec ("drop table bug_6364_t");
19
20$dbh->exec ("create table bug_6364_t (c1 varchar2(10), c2 varchar2(10), c3 varchar2(10), c4 varchar2(10), c5 varchar2(10))");
21
22$dbh->exec ("create or replace procedure bug_6364_sp(p1 IN varchar2, p2 IN varchar2, p3 IN varchar2, p4 OUT varchar2, p5 OUT varchar2) as begin insert into bug_6364_t (c1, c2, c3) values (p1, p2, p3); p4 := 'val4'; p5 := 'val5'; end;");
23
24$stmt = $dbh->prepare("call bug_6364_sp('p1','p2','p3',?,?)");
25
26$out_param1 = "a";
27$out_param2 = "a";
28
29$stmt->bindParam(1, $out_param1,PDO::PARAM_STR, 1024);
30$stmt->bindParam(2, $out_param2,PDO::PARAM_STR, 1024);
31
32$stmt->execute() or die ("Execution error: " . var_dump($dbh->errorInfo()));
33
34var_dump($out_param1);
35var_dump($out_param2);
36
37foreach ($dbh->query("select * from bug_6364_t") as $row) {
38    var_dump($row);
39}
40
41print "Done\n";
42
43// Cleanup
44$dbh->exec ("drop procedure bug_6364_sp");
45$dbh->exec ("drop table bug_6364_t");
46
47?>
48--EXPECT--
49string(4) "val4"
50string(4) "val5"
51array(10) {
52  ["c1"]=>
53  string(2) "p1"
54  [0]=>
55  string(2) "p1"
56  ["c2"]=>
57  string(2) "p2"
58  [1]=>
59  string(2) "p2"
60  ["c3"]=>
61  string(2) "p3"
62  [2]=>
63  string(2) "p3"
64  ["c4"]=>
65  NULL
66  [3]=>
67  NULL
68  ["c5"]=>
69  NULL
70  [4]=>
71  NULL
72}
73Done
74