Skip to content

Commit b4c5f20

Browse files
committed
Add IN bind case to bug74625.phpt
1 parent fa3615f commit b4c5f20

File tree

1 file changed

+49
-12
lines changed

1 file changed

+49
-12
lines changed

ext/oci8/tests/bug74625.phpt

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,63 @@ Bug #74625 (Integer overflow in oci_bind_array_by_name)
33
--SKIPIF--
44
<?php
55
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6-
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
76
?>
87
--FILE--
98
<?php
10-
119
require(dirname(__FILE__).'/connect.inc');
1210

13-
$s = oci_parse($c, "BEGIN
14-
SELECT -1 BULK COLLECT INTO :a FROM DUAL;
15-
END;");
16-
oci_bind_array_by_name($s, ':a', $a, 5000, 10, SQLT_INT);
17-
oci_execute($s);
11+
// Initialization
12+
13+
$stmtarray = array(
14+
"CREATE TABLE bug74625_tab (NAME NUMBER)",
15+
"CREATE OR REPLACE PACKAGE PKG74625 AS
16+
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
17+
PROCEDURE iobind(c1 IN OUT ARRTYPE);
18+
END PKG74625;",
19+
"CREATE OR REPLACE PACKAGE BODY PKG74625 AS
20+
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
21+
BEGIN
22+
FOR i IN 1..5 LOOP
23+
c1(i) := c1(i) * 2;
24+
END LOOP;
25+
END iobind;
26+
END PKG74625;"
27+
);
28+
29+
oci8_test_sql_execute($c, $stmtarray);
30+
31+
$statement = oci_parse($c, "BEGIN pkg74625.iobind(:c1); END;");
32+
33+
$array = Array(-1,-2,-3,-4,-5);
34+
35+
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT);
36+
37+
oci_execute($statement);
38+
39+
var_dump($array);
40+
41+
// Cleanup
42+
$stmtarray = array(
43+
"DROP TABLE bug74625_tab",
44+
"DROP PACKAGE PKG74625"
45+
);
46+
47+
oci8_test_sql_execute($c, $stmtarray);
1848

19-
var_dump($a);
2049
?>
2150
===DONE===
2251
<?php exit(0); ?>
2352
--EXPECTF--
24-
Array
25-
(
26-
[0] => -1
27-
)
53+
array(5) {
54+
[0]=>
55+
int(-2)
56+
[1]=>
57+
int(-4)
58+
[2]=>
59+
int(-6)
60+
[3]=>
61+
int(-8)
62+
[4]=>
63+
int(-10)
64+
}
2865
===DONE===

0 commit comments

Comments
 (0)