1--TEST--
2Bug #27303 (OCIBindByName binds numeric PHP values as characters)
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require(__DIR__."/connect.inc");
8// The bind buffer size edge cases seem to change each DB version.
9preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
10if (!(isset($matches[0]) && $matches[1] < 12)) {
11    die("skip expected output only valid when using pre-Oracle 12c database");
12}
13?>
14--FILE--
15<?php
16
17require __DIR__.'/connect.inc';
18
19$create_st = array();
20$create_st[] = "drop sequence myseq";
21$create_st[] = "drop table mytab";
22$create_st[] = "create sequence myseq";
23$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
24
25oci8_test_sql_execute($c, $create_st);
26
27define('MYLIMIT', 200);
28
29$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
30
31$stid = oci_parse($c, $stmt);
32if (!$stid) { echo "Parse error"; die; }
33
34$r = oci_bind_by_name($stid, ':MYBV', $mybv, 0 );
35if (!$r) { echo "Bind error"; die; }
36
37for ($i = 1; $i < MYLIMIT; $i++) {
38    $r = oci_execute($stid, OCI_DEFAULT);
39    if (!$r) { echo "Execute error"; die; }
40    var_dump($mybv);
41}
42
43oci_commit($c);
44
45$drop_st = array();
46$drop_st[] = "drop sequence myseq";
47$drop_st[] = "drop table mytab";
48
49oci8_test_sql_execute($c, $drop_st);
50
51echo "Done\n";
52?>
53--EXPECT--
54string(1) "1"
55string(1) "2"
56string(1) "3"
57string(1) "4"
58string(1) "5"
59string(1) "6"
60string(1) "7"
61string(1) "8"
62string(1) "9"
63string(1) "1"
64string(1) "1"
65string(1) "1"
66string(1) "1"
67string(1) "1"
68string(1) "1"
69string(1) "1"
70string(1) "1"
71string(1) "1"
72string(1) "1"
73string(1) "2"
74string(1) "2"
75string(1) "2"
76string(1) "2"
77string(1) "2"
78string(1) "2"
79string(1) "2"
80string(1) "2"
81string(1) "2"
82string(1) "2"
83string(1) "3"
84string(1) "3"
85string(1) "3"
86string(1) "3"
87string(1) "3"
88string(1) "3"
89string(1) "3"
90string(1) "3"
91string(1) "3"
92string(1) "3"
93string(1) "4"
94string(1) "4"
95string(1) "4"
96string(1) "4"
97string(1) "4"
98string(1) "4"
99string(1) "4"
100string(1) "4"
101string(1) "4"
102string(1) "4"
103string(1) "5"
104string(1) "5"
105string(1) "5"
106string(1) "5"
107string(1) "5"
108string(1) "5"
109string(1) "5"
110string(1) "5"
111string(1) "5"
112string(1) "5"
113string(1) "6"
114string(1) "6"
115string(1) "6"
116string(1) "6"
117string(1) "6"
118string(1) "6"
119string(1) "6"
120string(1) "6"
121string(1) "6"
122string(1) "6"
123string(1) "7"
124string(1) "7"
125string(1) "7"
126string(1) "7"
127string(1) "7"
128string(1) "7"
129string(1) "7"
130string(1) "7"
131string(1) "7"
132string(1) "7"
133string(1) "8"
134string(1) "8"
135string(1) "8"
136string(1) "8"
137string(1) "8"
138string(1) "8"
139string(1) "8"
140string(1) "8"
141string(1) "8"
142string(1) "8"
143string(1) "9"
144string(1) "9"
145string(1) "9"
146string(1) "9"
147string(1) "9"
148string(1) "9"
149string(1) "9"
150string(1) "9"
151string(1) "9"
152string(1) "9"
153string(1) "1"
154string(1) "1"
155string(1) "1"
156string(1) "1"
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"
253Done
254