1--TEST--
2Test << operator : various numbers as strings
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
6?>
7--FILE--
8<?php
9
10$strVals = array(
11   "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
12   "a5.9"
13);
14
15error_reporting(E_ERROR);
16
17foreach ($strVals as $strVal) {
18   foreach($strVals as $otherVal) {
19	  echo "--- testing: '$strVal' << '$otherVal' ---\n";
20      try {
21        var_dump(strVal<<$otherVal);
22      } catch (Throwable $e) {
23        echo "Exception: " . $e->getMessage() . "\n";
24      }
25   }
26}
27
28?>
29===DONE===
30--EXPECT--
31--- testing: '0' << '0' ---
32int(0)
33--- testing: '0' << '65' ---
34int(0)
35--- testing: '0' << '-44' ---
36Exception: Bit shift by negative number
37--- testing: '0' << '1.2' ---
38int(0)
39--- testing: '0' << '-7.7' ---
40Exception: Bit shift by negative number
41--- testing: '0' << 'abc' ---
42int(0)
43--- testing: '0' << '123abc' ---
44int(0)
45--- testing: '0' << '123e5' ---
46int(0)
47--- testing: '0' << '123e5xyz' ---
48int(0)
49--- testing: '0' << ' 123abc' ---
50int(0)
51--- testing: '0' << '123 abc' ---
52int(0)
53--- testing: '0' << '123abc ' ---
54int(0)
55--- testing: '0' << '3.4a' ---
56int(0)
57--- testing: '0' << 'a5.9' ---
58int(0)
59--- testing: '65' << '0' ---
60int(0)
61--- testing: '65' << '65' ---
62int(0)
63--- testing: '65' << '-44' ---
64Exception: Bit shift by negative number
65--- testing: '65' << '1.2' ---
66int(0)
67--- testing: '65' << '-7.7' ---
68Exception: Bit shift by negative number
69--- testing: '65' << 'abc' ---
70int(0)
71--- testing: '65' << '123abc' ---
72int(0)
73--- testing: '65' << '123e5' ---
74int(0)
75--- testing: '65' << '123e5xyz' ---
76int(0)
77--- testing: '65' << ' 123abc' ---
78int(0)
79--- testing: '65' << '123 abc' ---
80int(0)
81--- testing: '65' << '123abc ' ---
82int(0)
83--- testing: '65' << '3.4a' ---
84int(0)
85--- testing: '65' << 'a5.9' ---
86int(0)
87--- testing: '-44' << '0' ---
88int(0)
89--- testing: '-44' << '65' ---
90int(0)
91--- testing: '-44' << '-44' ---
92Exception: Bit shift by negative number
93--- testing: '-44' << '1.2' ---
94int(0)
95--- testing: '-44' << '-7.7' ---
96Exception: Bit shift by negative number
97--- testing: '-44' << 'abc' ---
98int(0)
99--- testing: '-44' << '123abc' ---
100int(0)
101--- testing: '-44' << '123e5' ---
102int(0)
103--- testing: '-44' << '123e5xyz' ---
104int(0)
105--- testing: '-44' << ' 123abc' ---
106int(0)
107--- testing: '-44' << '123 abc' ---
108int(0)
109--- testing: '-44' << '123abc ' ---
110int(0)
111--- testing: '-44' << '3.4a' ---
112int(0)
113--- testing: '-44' << 'a5.9' ---
114int(0)
115--- testing: '1.2' << '0' ---
116int(0)
117--- testing: '1.2' << '65' ---
118int(0)
119--- testing: '1.2' << '-44' ---
120Exception: Bit shift by negative number
121--- testing: '1.2' << '1.2' ---
122int(0)
123--- testing: '1.2' << '-7.7' ---
124Exception: Bit shift by negative number
125--- testing: '1.2' << 'abc' ---
126int(0)
127--- testing: '1.2' << '123abc' ---
128int(0)
129--- testing: '1.2' << '123e5' ---
130int(0)
131--- testing: '1.2' << '123e5xyz' ---
132int(0)
133--- testing: '1.2' << ' 123abc' ---
134int(0)
135--- testing: '1.2' << '123 abc' ---
136int(0)
137--- testing: '1.2' << '123abc ' ---
138int(0)
139--- testing: '1.2' << '3.4a' ---
140int(0)
141--- testing: '1.2' << 'a5.9' ---
142int(0)
143--- testing: '-7.7' << '0' ---
144int(0)
145--- testing: '-7.7' << '65' ---
146int(0)
147--- testing: '-7.7' << '-44' ---
148Exception: Bit shift by negative number
149--- testing: '-7.7' << '1.2' ---
150int(0)
151--- testing: '-7.7' << '-7.7' ---
152Exception: Bit shift by negative number
153--- testing: '-7.7' << 'abc' ---
154int(0)
155--- testing: '-7.7' << '123abc' ---
156int(0)
157--- testing: '-7.7' << '123e5' ---
158int(0)
159--- testing: '-7.7' << '123e5xyz' ---
160int(0)
161--- testing: '-7.7' << ' 123abc' ---
162int(0)
163--- testing: '-7.7' << '123 abc' ---
164int(0)
165--- testing: '-7.7' << '123abc ' ---
166int(0)
167--- testing: '-7.7' << '3.4a' ---
168int(0)
169--- testing: '-7.7' << 'a5.9' ---
170int(0)
171--- testing: 'abc' << '0' ---
172int(0)
173--- testing: 'abc' << '65' ---
174int(0)
175--- testing: 'abc' << '-44' ---
176Exception: Bit shift by negative number
177--- testing: 'abc' << '1.2' ---
178int(0)
179--- testing: 'abc' << '-7.7' ---
180Exception: Bit shift by negative number
181--- testing: 'abc' << 'abc' ---
182int(0)
183--- testing: 'abc' << '123abc' ---
184int(0)
185--- testing: 'abc' << '123e5' ---
186int(0)
187--- testing: 'abc' << '123e5xyz' ---
188int(0)
189--- testing: 'abc' << ' 123abc' ---
190int(0)
191--- testing: 'abc' << '123 abc' ---
192int(0)
193--- testing: 'abc' << '123abc ' ---
194int(0)
195--- testing: 'abc' << '3.4a' ---
196int(0)
197--- testing: 'abc' << 'a5.9' ---
198int(0)
199--- testing: '123abc' << '0' ---
200int(0)
201--- testing: '123abc' << '65' ---
202int(0)
203--- testing: '123abc' << '-44' ---
204Exception: Bit shift by negative number
205--- testing: '123abc' << '1.2' ---
206int(0)
207--- testing: '123abc' << '-7.7' ---
208Exception: Bit shift by negative number
209--- testing: '123abc' << 'abc' ---
210int(0)
211--- testing: '123abc' << '123abc' ---
212int(0)
213--- testing: '123abc' << '123e5' ---
214int(0)
215--- testing: '123abc' << '123e5xyz' ---
216int(0)
217--- testing: '123abc' << ' 123abc' ---
218int(0)
219--- testing: '123abc' << '123 abc' ---
220int(0)
221--- testing: '123abc' << '123abc ' ---
222int(0)
223--- testing: '123abc' << '3.4a' ---
224int(0)
225--- testing: '123abc' << 'a5.9' ---
226int(0)
227--- testing: '123e5' << '0' ---
228int(0)
229--- testing: '123e5' << '65' ---
230int(0)
231--- testing: '123e5' << '-44' ---
232Exception: Bit shift by negative number
233--- testing: '123e5' << '1.2' ---
234int(0)
235--- testing: '123e5' << '-7.7' ---
236Exception: Bit shift by negative number
237--- testing: '123e5' << 'abc' ---
238int(0)
239--- testing: '123e5' << '123abc' ---
240int(0)
241--- testing: '123e5' << '123e5' ---
242int(0)
243--- testing: '123e5' << '123e5xyz' ---
244int(0)
245--- testing: '123e5' << ' 123abc' ---
246int(0)
247--- testing: '123e5' << '123 abc' ---
248int(0)
249--- testing: '123e5' << '123abc ' ---
250int(0)
251--- testing: '123e5' << '3.4a' ---
252int(0)
253--- testing: '123e5' << 'a5.9' ---
254int(0)
255--- testing: '123e5xyz' << '0' ---
256int(0)
257--- testing: '123e5xyz' << '65' ---
258int(0)
259--- testing: '123e5xyz' << '-44' ---
260Exception: Bit shift by negative number
261--- testing: '123e5xyz' << '1.2' ---
262int(0)
263--- testing: '123e5xyz' << '-7.7' ---
264Exception: Bit shift by negative number
265--- testing: '123e5xyz' << 'abc' ---
266int(0)
267--- testing: '123e5xyz' << '123abc' ---
268int(0)
269--- testing: '123e5xyz' << '123e5' ---
270int(0)
271--- testing: '123e5xyz' << '123e5xyz' ---
272int(0)
273--- testing: '123e5xyz' << ' 123abc' ---
274int(0)
275--- testing: '123e5xyz' << '123 abc' ---
276int(0)
277--- testing: '123e5xyz' << '123abc ' ---
278int(0)
279--- testing: '123e5xyz' << '3.4a' ---
280int(0)
281--- testing: '123e5xyz' << 'a5.9' ---
282int(0)
283--- testing: ' 123abc' << '0' ---
284int(0)
285--- testing: ' 123abc' << '65' ---
286int(0)
287--- testing: ' 123abc' << '-44' ---
288Exception: Bit shift by negative number
289--- testing: ' 123abc' << '1.2' ---
290int(0)
291--- testing: ' 123abc' << '-7.7' ---
292Exception: Bit shift by negative number
293--- testing: ' 123abc' << 'abc' ---
294int(0)
295--- testing: ' 123abc' << '123abc' ---
296int(0)
297--- testing: ' 123abc' << '123e5' ---
298int(0)
299--- testing: ' 123abc' << '123e5xyz' ---
300int(0)
301--- testing: ' 123abc' << ' 123abc' ---
302int(0)
303--- testing: ' 123abc' << '123 abc' ---
304int(0)
305--- testing: ' 123abc' << '123abc ' ---
306int(0)
307--- testing: ' 123abc' << '3.4a' ---
308int(0)
309--- testing: ' 123abc' << 'a5.9' ---
310int(0)
311--- testing: '123 abc' << '0' ---
312int(0)
313--- testing: '123 abc' << '65' ---
314int(0)
315--- testing: '123 abc' << '-44' ---
316Exception: Bit shift by negative number
317--- testing: '123 abc' << '1.2' ---
318int(0)
319--- testing: '123 abc' << '-7.7' ---
320Exception: Bit shift by negative number
321--- testing: '123 abc' << 'abc' ---
322int(0)
323--- testing: '123 abc' << '123abc' ---
324int(0)
325--- testing: '123 abc' << '123e5' ---
326int(0)
327--- testing: '123 abc' << '123e5xyz' ---
328int(0)
329--- testing: '123 abc' << ' 123abc' ---
330int(0)
331--- testing: '123 abc' << '123 abc' ---
332int(0)
333--- testing: '123 abc' << '123abc ' ---
334int(0)
335--- testing: '123 abc' << '3.4a' ---
336int(0)
337--- testing: '123 abc' << 'a5.9' ---
338int(0)
339--- testing: '123abc ' << '0' ---
340int(0)
341--- testing: '123abc ' << '65' ---
342int(0)
343--- testing: '123abc ' << '-44' ---
344Exception: Bit shift by negative number
345--- testing: '123abc ' << '1.2' ---
346int(0)
347--- testing: '123abc ' << '-7.7' ---
348Exception: Bit shift by negative number
349--- testing: '123abc ' << 'abc' ---
350int(0)
351--- testing: '123abc ' << '123abc' ---
352int(0)
353--- testing: '123abc ' << '123e5' ---
354int(0)
355--- testing: '123abc ' << '123e5xyz' ---
356int(0)
357--- testing: '123abc ' << ' 123abc' ---
358int(0)
359--- testing: '123abc ' << '123 abc' ---
360int(0)
361--- testing: '123abc ' << '123abc ' ---
362int(0)
363--- testing: '123abc ' << '3.4a' ---
364int(0)
365--- testing: '123abc ' << 'a5.9' ---
366int(0)
367--- testing: '3.4a' << '0' ---
368int(0)
369--- testing: '3.4a' << '65' ---
370int(0)
371--- testing: '3.4a' << '-44' ---
372Exception: Bit shift by negative number
373--- testing: '3.4a' << '1.2' ---
374int(0)
375--- testing: '3.4a' << '-7.7' ---
376Exception: Bit shift by negative number
377--- testing: '3.4a' << 'abc' ---
378int(0)
379--- testing: '3.4a' << '123abc' ---
380int(0)
381--- testing: '3.4a' << '123e5' ---
382int(0)
383--- testing: '3.4a' << '123e5xyz' ---
384int(0)
385--- testing: '3.4a' << ' 123abc' ---
386int(0)
387--- testing: '3.4a' << '123 abc' ---
388int(0)
389--- testing: '3.4a' << '123abc ' ---
390int(0)
391--- testing: '3.4a' << '3.4a' ---
392int(0)
393--- testing: '3.4a' << 'a5.9' ---
394int(0)
395--- testing: 'a5.9' << '0' ---
396int(0)
397--- testing: 'a5.9' << '65' ---
398int(0)
399--- testing: 'a5.9' << '-44' ---
400Exception: Bit shift by negative number
401--- testing: 'a5.9' << '1.2' ---
402int(0)
403--- testing: 'a5.9' << '-7.7' ---
404Exception: Bit shift by negative number
405--- testing: 'a5.9' << 'abc' ---
406int(0)
407--- testing: 'a5.9' << '123abc' ---
408int(0)
409--- testing: 'a5.9' << '123e5' ---
410int(0)
411--- testing: 'a5.9' << '123e5xyz' ---
412int(0)
413--- testing: 'a5.9' << ' 123abc' ---
414int(0)
415--- testing: 'a5.9' << '123 abc' ---
416int(0)
417--- testing: 'a5.9' << '123abc ' ---
418int(0)
419--- testing: 'a5.9' << '3.4a' ---
420int(0)
421--- testing: 'a5.9' << 'a5.9' ---
422int(0)
423===DONE===
424