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