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.
8preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
9if (!(isset($matches[0]) && $matches[1] < 12)) {
10    die("skip expected output only valid when using pre-Oracle 12c database");
11}
12?>
13--FILE--
14<?php
15
16require dirname(__FILE__).'/connect.inc';
17
18$create_st = array();
19$create_st[] = "drop sequence myseq";
20$create_st[] = "drop table mytab";
21$create_st[] = "create sequence myseq";
22$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
23
24oci8_test_sql_execute($c, $create_st);
25
26define('MYLIMIT', 200);
27
28$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
29
30$stid = OCIParse($c, $stmt);
31if (!$stid) { echo "Parse error"; die; }
32
33$r = OCIBindByName($stid, ':MYBV', $mybv, 0 );
34if (!$r) { echo "Bind error"; die; }
35
36for ($i = 1; $i < MYLIMIT; $i++) {
37	$r = OCIExecute($stid, OCI_DEFAULT);
38	if (!$r) { echo "Execute error"; die; }
39	var_dump($mybv);
40}
41
42OCICommit($c);
43
44$drop_st = array();
45$drop_st[] = "drop sequence myseq";
46$drop_st[] = "drop table mytab";
47
48oci8_test_sql_execute($c, $drop_st);
49
50echo "Done\n";
51?>
52--EXPECT--
53string(1) "1"
54string(1) "2"
55string(1) "3"
56string(1) "4"
57string(1) "5"
58string(1) "6"
59string(1) "7"
60string(1) "8"
61string(1) "9"
62string(1) "1"
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) "2"
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) "3"
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) "4"
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) "5"
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) "6"
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) "7"
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) "8"
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) "9"
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) "1"
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"
252Done
253