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--EXPECTF--
46string(4) "val4"
47string(4) "val5"
48array(10) {
49  ["c1"]=>
50  string(2) "p1"
51  [0]=>
52  string(2) "p1"
53  ["c2"]=>
54  string(2) "p2"
55  [1]=>
56  string(2) "p2"
57  ["c3"]=>
58  string(2) "p3"
59  [2]=>
60  string(2) "p3"
61  ["c4"]=>
62  NULL
63  [3]=>
64  NULL
65  ["c5"]=>
66  NULL
67  [4]=>
68  NULL
69}
70Done
71