1--TEST--
2Bug #27303 (OCIBindByName binds numeric PHP values as characters)
3--SKIPIF--
4<?php
5if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6require(dirname(__FILE__)."/connect.inc");
7// The bind buffer size edge cases seem to change each DB version.
8if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
9    if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) {
10        if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
11            die("skip expected output only valid when using specific Oracle database versions");
12        }
13    }
14}
15?>
16--FILE--
17<?php
18
19require(dirname(__FILE__).'/connect.inc');
20
21$stmtarray = array(
22    "drop sequence myseq",
23    "drop table mytab",
24    "create sequence myseq",
25    "create table mytab (mydata varchar2(20), seqcol number)"
26);
27
28oci8_test_sql_execute($c, $stmtarray);
29
30define('MYLIMIT', 200);
31
32$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
33
34$stid = OCIParse($c, $stmt);
35if (!$stid) { echo "Parse error"; die; }
36
37$r = OCIBindByName($stid, ':MYBV', $mybv);
38if (!$r) { echo "Bind error"; die; }
39
40for ($i = 1; $i < MYLIMIT; $i++) {
41	$r = OCIExecute($stid, OCI_DEFAULT);
42	if (!$r) { echo "Execute error"; die; }
43	var_dump($mybv);
44}
45
46OCICommit($c);
47
48$stmtarray = array(
49    "drop sequence myseq",
50    "drop table mytab"
51);
52
53oci8_test_sql_execute($c, $stmtarray);
54
55echo "Done\n";
56?>
57--EXPECT--
58string(1) "1"
59string(1) "2"
60string(1) "3"
61string(1) "4"
62string(1) "5"
63string(1) "6"
64string(1) "7"
65string(1) "8"
66string(1) "9"
67string(1) "1"
68string(1) "1"
69string(1) "1"
70string(1) "1"
71string(1) "1"
72string(1) "1"
73string(1) "1"
74string(1) "1"
75string(1) "1"
76string(1) "1"
77string(1) "2"
78string(1) "2"
79string(1) "2"
80string(1) "2"
81string(1) "2"
82string(1) "2"
83string(1) "2"
84string(1) "2"
85string(1) "2"
86string(1) "2"
87string(1) "3"
88string(1) "3"
89string(1) "3"
90string(1) "3"
91string(1) "3"
92string(1) "3"
93string(1) "3"
94string(1) "3"
95string(1) "3"
96string(1) "3"
97string(1) "4"
98string(1) "4"
99string(1) "4"
100string(1) "4"
101string(1) "4"
102string(1) "4"
103string(1) "4"
104string(1) "4"
105string(1) "4"
106string(1) "4"
107string(1) "5"
108string(1) "5"
109string(1) "5"
110string(1) "5"
111string(1) "5"
112string(1) "5"
113string(1) "5"
114string(1) "5"
115string(1) "5"
116string(1) "5"
117string(1) "6"
118string(1) "6"
119string(1) "6"
120string(1) "6"
121string(1) "6"
122string(1) "6"
123string(1) "6"
124string(1) "6"
125string(1) "6"
126string(1) "6"
127string(1) "7"
128string(1) "7"
129string(1) "7"
130string(1) "7"
131string(1) "7"
132string(1) "7"
133string(1) "7"
134string(1) "7"
135string(1) "7"
136string(1) "7"
137string(1) "8"
138string(1) "8"
139string(1) "8"
140string(1) "8"
141string(1) "8"
142string(1) "8"
143string(1) "8"
144string(1) "8"
145string(1) "8"
146string(1) "8"
147string(1) "9"
148string(1) "9"
149string(1) "9"
150string(1) "9"
151string(1) "9"
152string(1) "9"
153string(1) "9"
154string(1) "9"
155string(1) "9"
156string(1) "9"
157string(1) "1"
158string(1) "1"
159string(1) "1"
160string(1) "1"
161string(1) "1"
162string(1) "1"
163string(1) "1"
164string(1) "1"
165string(1) "1"
166string(1) "1"
167string(1) "1"
168string(1) "1"
169string(1) "1"
170string(1) "1"
171string(1) "1"
172string(1) "1"
173string(1) "1"
174string(1) "1"
175string(1) "1"
176string(1) "1"
177string(1) "1"
178string(1) "1"
179string(1) "1"
180string(1) "1"
181string(1) "1"
182string(1) "1"
183string(1) "1"
184string(1) "1"
185string(1) "1"
186string(1) "1"
187string(1) "1"
188string(1) "1"
189string(1) "1"
190string(1) "1"
191string(1) "1"
192string(1) "1"
193string(1) "1"
194string(1) "1"
195string(1) "1"
196string(1) "1"
197string(1) "1"
198string(1) "1"
199string(1) "1"
200string(1) "1"
201string(1) "1"
202string(1) "1"
203string(1) "1"
204string(1) "1"
205string(1) "1"
206string(1) "1"
207string(1) "1"
208string(1) "1"
209string(1) "1"
210string(1) "1"
211string(1) "1"
212string(1) "1"
213string(1) "1"
214string(1) "1"
215string(1) "1"
216string(1) "1"
217string(1) "1"
218string(1) "1"
219string(1) "1"
220string(1) "1"
221string(1) "1"
222string(1) "1"
223string(1) "1"
224string(1) "1"
225string(1) "1"
226string(1) "1"
227string(1) "1"
228string(1) "1"
229string(1) "1"
230string(1) "1"
231string(1) "1"
232string(1) "1"
233string(1) "1"
234string(1) "1"
235string(1) "1"
236string(1) "1"
237string(1) "1"
238string(1) "1"
239string(1) "1"
240string(1) "1"
241string(1) "1"
242string(1) "1"
243string(1) "1"
244string(1) "1"
245string(1) "1"
246string(1) "1"
247string(1) "1"
248string(1) "1"
249string(1) "1"
250string(1) "1"
251string(1) "1"
252string(1) "1"
253string(1) "1"
254string(1) "1"
255string(1) "1"
256string(1) "1"
257Done
258