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