1--TEST--
2Test ^ operator : 64bit long tests
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--FILE--
8<?php
9
10define("MAX_64Bit", 9223372036854775807);
11define("MAX_32Bit", 2147483647);
12define("MIN_64Bit", -9223372036854775807 - 1);
13define("MIN_32Bit", -2147483647 - 1);
14
15$longVals = array(
16    MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
17    MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
18    MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
19);
20
21$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
22
23error_reporting(E_ERROR);
24
25foreach ($longVals as $longVal) {
26   foreach($otherVals as $otherVal) {
27       echo "--- testing: $longVal ^ $otherVal ---\n";
28      var_dump($longVal^$otherVal);
29   }
30}
31
32foreach ($otherVals as $otherVal) {
33   foreach($longVals as $longVal) {
34       echo "--- testing: $otherVal ^ $longVal ---\n";
35      var_dump($otherVal^$longVal);
36   }
37}
38
39?>
40--EXPECT--
41--- testing: 9223372036854775807 ^ 0 ---
42int(9223372036854775807)
43--- testing: 9223372036854775807 ^ 1 ---
44int(9223372036854775806)
45--- testing: 9223372036854775807 ^ -1 ---
46int(-9223372036854775808)
47--- testing: 9223372036854775807 ^ 7 ---
48int(9223372036854775800)
49--- testing: 9223372036854775807 ^ 9 ---
50int(9223372036854775798)
51--- testing: 9223372036854775807 ^ 65 ---
52int(9223372036854775742)
53--- testing: 9223372036854775807 ^ -44 ---
54int(-9223372036854775765)
55--- testing: 9223372036854775807 ^ 2147483647 ---
56int(9223372034707292160)
57--- testing: 9223372036854775807 ^ 9223372036854775807 ---
58int(0)
59--- testing: -9223372036854775808 ^ 0 ---
60int(-9223372036854775808)
61--- testing: -9223372036854775808 ^ 1 ---
62int(-9223372036854775807)
63--- testing: -9223372036854775808 ^ -1 ---
64int(9223372036854775807)
65--- testing: -9223372036854775808 ^ 7 ---
66int(-9223372036854775801)
67--- testing: -9223372036854775808 ^ 9 ---
68int(-9223372036854775799)
69--- testing: -9223372036854775808 ^ 65 ---
70int(-9223372036854775743)
71--- testing: -9223372036854775808 ^ -44 ---
72int(9223372036854775764)
73--- testing: -9223372036854775808 ^ 2147483647 ---
74int(-9223372034707292161)
75--- testing: -9223372036854775808 ^ 9223372036854775807 ---
76int(-1)
77--- testing: 2147483647 ^ 0 ---
78int(2147483647)
79--- testing: 2147483647 ^ 1 ---
80int(2147483646)
81--- testing: 2147483647 ^ -1 ---
82int(-2147483648)
83--- testing: 2147483647 ^ 7 ---
84int(2147483640)
85--- testing: 2147483647 ^ 9 ---
86int(2147483638)
87--- testing: 2147483647 ^ 65 ---
88int(2147483582)
89--- testing: 2147483647 ^ -44 ---
90int(-2147483605)
91--- testing: 2147483647 ^ 2147483647 ---
92int(0)
93--- testing: 2147483647 ^ 9223372036854775807 ---
94int(9223372034707292160)
95--- testing: -2147483648 ^ 0 ---
96int(-2147483648)
97--- testing: -2147483648 ^ 1 ---
98int(-2147483647)
99--- testing: -2147483648 ^ -1 ---
100int(2147483647)
101--- testing: -2147483648 ^ 7 ---
102int(-2147483641)
103--- testing: -2147483648 ^ 9 ---
104int(-2147483639)
105--- testing: -2147483648 ^ 65 ---
106int(-2147483583)
107--- testing: -2147483648 ^ -44 ---
108int(2147483604)
109--- testing: -2147483648 ^ 2147483647 ---
110int(-1)
111--- testing: -2147483648 ^ 9223372036854775807 ---
112int(-9223372034707292161)
113--- testing: 9223372034707292160 ^ 0 ---
114int(9223372034707292160)
115--- testing: 9223372034707292160 ^ 1 ---
116int(9223372034707292161)
117--- testing: 9223372034707292160 ^ -1 ---
118int(-9223372034707292161)
119--- testing: 9223372034707292160 ^ 7 ---
120int(9223372034707292167)
121--- testing: 9223372034707292160 ^ 9 ---
122int(9223372034707292169)
123--- testing: 9223372034707292160 ^ 65 ---
124int(9223372034707292225)
125--- testing: 9223372034707292160 ^ -44 ---
126int(-9223372034707292204)
127--- testing: 9223372034707292160 ^ 2147483647 ---
128int(9223372036854775807)
129--- testing: 9223372034707292160 ^ 9223372036854775807 ---
130int(2147483647)
131--- testing: -9223372034707292160 ^ 0 ---
132int(-9223372034707292160)
133--- testing: -9223372034707292160 ^ 1 ---
134int(-9223372034707292159)
135--- testing: -9223372034707292160 ^ -1 ---
136int(9223372034707292159)
137--- testing: -9223372034707292160 ^ 7 ---
138int(-9223372034707292153)
139--- testing: -9223372034707292160 ^ 9 ---
140int(-9223372034707292151)
141--- testing: -9223372034707292160 ^ 65 ---
142int(-9223372034707292095)
143--- testing: -9223372034707292160 ^ -44 ---
144int(9223372034707292116)
145--- testing: -9223372034707292160 ^ 2147483647 ---
146int(-9223372032559808513)
147--- testing: -9223372034707292160 ^ 9223372036854775807 ---
148int(-2147483649)
149--- testing: 2147483648 ^ 0 ---
150int(2147483648)
151--- testing: 2147483648 ^ 1 ---
152int(2147483649)
153--- testing: 2147483648 ^ -1 ---
154int(-2147483649)
155--- testing: 2147483648 ^ 7 ---
156int(2147483655)
157--- testing: 2147483648 ^ 9 ---
158int(2147483657)
159--- testing: 2147483648 ^ 65 ---
160int(2147483713)
161--- testing: 2147483648 ^ -44 ---
162int(-2147483692)
163--- testing: 2147483648 ^ 2147483647 ---
164int(4294967295)
165--- testing: 2147483648 ^ 9223372036854775807 ---
166int(9223372034707292159)
167--- testing: -2147483649 ^ 0 ---
168int(-2147483649)
169--- testing: -2147483649 ^ 1 ---
170int(-2147483650)
171--- testing: -2147483649 ^ -1 ---
172int(2147483648)
173--- testing: -2147483649 ^ 7 ---
174int(-2147483656)
175--- testing: -2147483649 ^ 9 ---
176int(-2147483658)
177--- testing: -2147483649 ^ 65 ---
178int(-2147483714)
179--- testing: -2147483649 ^ -44 ---
180int(2147483691)
181--- testing: -2147483649 ^ 2147483647 ---
182int(-4294967296)
183--- testing: -2147483649 ^ 9223372036854775807 ---
184int(-9223372034707292160)
185--- testing: 4294967294 ^ 0 ---
186int(4294967294)
187--- testing: 4294967294 ^ 1 ---
188int(4294967295)
189--- testing: 4294967294 ^ -1 ---
190int(-4294967295)
191--- testing: 4294967294 ^ 7 ---
192int(4294967289)
193--- testing: 4294967294 ^ 9 ---
194int(4294967287)
195--- testing: 4294967294 ^ 65 ---
196int(4294967231)
197--- testing: 4294967294 ^ -44 ---
198int(-4294967254)
199--- testing: 4294967294 ^ 2147483647 ---
200int(2147483649)
201--- testing: 4294967294 ^ 9223372036854775807 ---
202int(9223372032559808513)
203--- testing: 4294967295 ^ 0 ---
204int(4294967295)
205--- testing: 4294967295 ^ 1 ---
206int(4294967294)
207--- testing: 4294967295 ^ -1 ---
208int(-4294967296)
209--- testing: 4294967295 ^ 7 ---
210int(4294967288)
211--- testing: 4294967295 ^ 9 ---
212int(4294967286)
213--- testing: 4294967295 ^ 65 ---
214int(4294967230)
215--- testing: 4294967295 ^ -44 ---
216int(-4294967253)
217--- testing: 4294967295 ^ 2147483647 ---
218int(2147483648)
219--- testing: 4294967295 ^ 9223372036854775807 ---
220int(9223372032559808512)
221--- testing: 4294967293 ^ 0 ---
222int(4294967293)
223--- testing: 4294967293 ^ 1 ---
224int(4294967292)
225--- testing: 4294967293 ^ -1 ---
226int(-4294967294)
227--- testing: 4294967293 ^ 7 ---
228int(4294967290)
229--- testing: 4294967293 ^ 9 ---
230int(4294967284)
231--- testing: 4294967293 ^ 65 ---
232int(4294967228)
233--- testing: 4294967293 ^ -44 ---
234int(-4294967255)
235--- testing: 4294967293 ^ 2147483647 ---
236int(2147483650)
237--- testing: 4294967293 ^ 9223372036854775807 ---
238int(9223372032559808514)
239--- testing: 9223372036854775806 ^ 0 ---
240int(9223372036854775806)
241--- testing: 9223372036854775806 ^ 1 ---
242int(9223372036854775807)
243--- testing: 9223372036854775806 ^ -1 ---
244int(-9223372036854775807)
245--- testing: 9223372036854775806 ^ 7 ---
246int(9223372036854775801)
247--- testing: 9223372036854775806 ^ 9 ---
248int(9223372036854775799)
249--- testing: 9223372036854775806 ^ 65 ---
250int(9223372036854775743)
251--- testing: 9223372036854775806 ^ -44 ---
252int(-9223372036854775766)
253--- testing: 9223372036854775806 ^ 2147483647 ---
254int(9223372034707292161)
255--- testing: 9223372036854775806 ^ 9223372036854775807 ---
256int(1)
257--- testing: 9.2233720368548E+18 ^ 0 ---
258int(-9223372036854775808)
259--- testing: 9.2233720368548E+18 ^ 1 ---
260int(-9223372036854775807)
261--- testing: 9.2233720368548E+18 ^ -1 ---
262int(9223372036854775807)
263--- testing: 9.2233720368548E+18 ^ 7 ---
264int(-9223372036854775801)
265--- testing: 9.2233720368548E+18 ^ 9 ---
266int(-9223372036854775799)
267--- testing: 9.2233720368548E+18 ^ 65 ---
268int(-9223372036854775743)
269--- testing: 9.2233720368548E+18 ^ -44 ---
270int(9223372036854775764)
271--- testing: 9.2233720368548E+18 ^ 2147483647 ---
272int(-9223372034707292161)
273--- testing: 9.2233720368548E+18 ^ 9223372036854775807 ---
274int(-1)
275--- testing: -9223372036854775807 ^ 0 ---
276int(-9223372036854775807)
277--- testing: -9223372036854775807 ^ 1 ---
278int(-9223372036854775808)
279--- testing: -9223372036854775807 ^ -1 ---
280int(9223372036854775806)
281--- testing: -9223372036854775807 ^ 7 ---
282int(-9223372036854775802)
283--- testing: -9223372036854775807 ^ 9 ---
284int(-9223372036854775800)
285--- testing: -9223372036854775807 ^ 65 ---
286int(-9223372036854775744)
287--- testing: -9223372036854775807 ^ -44 ---
288int(9223372036854775765)
289--- testing: -9223372036854775807 ^ 2147483647 ---
290int(-9223372034707292162)
291--- testing: -9223372036854775807 ^ 9223372036854775807 ---
292int(-2)
293--- testing: -9.2233720368548E+18 ^ 0 ---
294int(-9223372036854775808)
295--- testing: -9.2233720368548E+18 ^ 1 ---
296int(-9223372036854775807)
297--- testing: -9.2233720368548E+18 ^ -1 ---
298int(9223372036854775807)
299--- testing: -9.2233720368548E+18 ^ 7 ---
300int(-9223372036854775801)
301--- testing: -9.2233720368548E+18 ^ 9 ---
302int(-9223372036854775799)
303--- testing: -9.2233720368548E+18 ^ 65 ---
304int(-9223372036854775743)
305--- testing: -9.2233720368548E+18 ^ -44 ---
306int(9223372036854775764)
307--- testing: -9.2233720368548E+18 ^ 2147483647 ---
308int(-9223372034707292161)
309--- testing: -9.2233720368548E+18 ^ 9223372036854775807 ---
310int(-1)
311--- testing: 0 ^ 9223372036854775807 ---
312int(9223372036854775807)
313--- testing: 0 ^ -9223372036854775808 ---
314int(-9223372036854775808)
315--- testing: 0 ^ 2147483647 ---
316int(2147483647)
317--- testing: 0 ^ -2147483648 ---
318int(-2147483648)
319--- testing: 0 ^ 9223372034707292160 ---
320int(9223372034707292160)
321--- testing: 0 ^ -9223372034707292160 ---
322int(-9223372034707292160)
323--- testing: 0 ^ 2147483648 ---
324int(2147483648)
325--- testing: 0 ^ -2147483649 ---
326int(-2147483649)
327--- testing: 0 ^ 4294967294 ---
328int(4294967294)
329--- testing: 0 ^ 4294967295 ---
330int(4294967295)
331--- testing: 0 ^ 4294967293 ---
332int(4294967293)
333--- testing: 0 ^ 9223372036854775806 ---
334int(9223372036854775806)
335--- testing: 0 ^ 9.2233720368548E+18 ---
336int(-9223372036854775808)
337--- testing: 0 ^ -9223372036854775807 ---
338int(-9223372036854775807)
339--- testing: 0 ^ -9.2233720368548E+18 ---
340int(-9223372036854775808)
341--- testing: 1 ^ 9223372036854775807 ---
342int(9223372036854775806)
343--- testing: 1 ^ -9223372036854775808 ---
344int(-9223372036854775807)
345--- testing: 1 ^ 2147483647 ---
346int(2147483646)
347--- testing: 1 ^ -2147483648 ---
348int(-2147483647)
349--- testing: 1 ^ 9223372034707292160 ---
350int(9223372034707292161)
351--- testing: 1 ^ -9223372034707292160 ---
352int(-9223372034707292159)
353--- testing: 1 ^ 2147483648 ---
354int(2147483649)
355--- testing: 1 ^ -2147483649 ---
356int(-2147483650)
357--- testing: 1 ^ 4294967294 ---
358int(4294967295)
359--- testing: 1 ^ 4294967295 ---
360int(4294967294)
361--- testing: 1 ^ 4294967293 ---
362int(4294967292)
363--- testing: 1 ^ 9223372036854775806 ---
364int(9223372036854775807)
365--- testing: 1 ^ 9.2233720368548E+18 ---
366int(-9223372036854775807)
367--- testing: 1 ^ -9223372036854775807 ---
368int(-9223372036854775808)
369--- testing: 1 ^ -9.2233720368548E+18 ---
370int(-9223372036854775807)
371--- testing: -1 ^ 9223372036854775807 ---
372int(-9223372036854775808)
373--- testing: -1 ^ -9223372036854775808 ---
374int(9223372036854775807)
375--- testing: -1 ^ 2147483647 ---
376int(-2147483648)
377--- testing: -1 ^ -2147483648 ---
378int(2147483647)
379--- testing: -1 ^ 9223372034707292160 ---
380int(-9223372034707292161)
381--- testing: -1 ^ -9223372034707292160 ---
382int(9223372034707292159)
383--- testing: -1 ^ 2147483648 ---
384int(-2147483649)
385--- testing: -1 ^ -2147483649 ---
386int(2147483648)
387--- testing: -1 ^ 4294967294 ---
388int(-4294967295)
389--- testing: -1 ^ 4294967295 ---
390int(-4294967296)
391--- testing: -1 ^ 4294967293 ---
392int(-4294967294)
393--- testing: -1 ^ 9223372036854775806 ---
394int(-9223372036854775807)
395--- testing: -1 ^ 9.2233720368548E+18 ---
396int(9223372036854775807)
397--- testing: -1 ^ -9223372036854775807 ---
398int(9223372036854775806)
399--- testing: -1 ^ -9.2233720368548E+18 ---
400int(9223372036854775807)
401--- testing: 7 ^ 9223372036854775807 ---
402int(9223372036854775800)
403--- testing: 7 ^ -9223372036854775808 ---
404int(-9223372036854775801)
405--- testing: 7 ^ 2147483647 ---
406int(2147483640)
407--- testing: 7 ^ -2147483648 ---
408int(-2147483641)
409--- testing: 7 ^ 9223372034707292160 ---
410int(9223372034707292167)
411--- testing: 7 ^ -9223372034707292160 ---
412int(-9223372034707292153)
413--- testing: 7 ^ 2147483648 ---
414int(2147483655)
415--- testing: 7 ^ -2147483649 ---
416int(-2147483656)
417--- testing: 7 ^ 4294967294 ---
418int(4294967289)
419--- testing: 7 ^ 4294967295 ---
420int(4294967288)
421--- testing: 7 ^ 4294967293 ---
422int(4294967290)
423--- testing: 7 ^ 9223372036854775806 ---
424int(9223372036854775801)
425--- testing: 7 ^ 9.2233720368548E+18 ---
426int(-9223372036854775801)
427--- testing: 7 ^ -9223372036854775807 ---
428int(-9223372036854775802)
429--- testing: 7 ^ -9.2233720368548E+18 ---
430int(-9223372036854775801)
431--- testing: 9 ^ 9223372036854775807 ---
432int(9223372036854775798)
433--- testing: 9 ^ -9223372036854775808 ---
434int(-9223372036854775799)
435--- testing: 9 ^ 2147483647 ---
436int(2147483638)
437--- testing: 9 ^ -2147483648 ---
438int(-2147483639)
439--- testing: 9 ^ 9223372034707292160 ---
440int(9223372034707292169)
441--- testing: 9 ^ -9223372034707292160 ---
442int(-9223372034707292151)
443--- testing: 9 ^ 2147483648 ---
444int(2147483657)
445--- testing: 9 ^ -2147483649 ---
446int(-2147483658)
447--- testing: 9 ^ 4294967294 ---
448int(4294967287)
449--- testing: 9 ^ 4294967295 ---
450int(4294967286)
451--- testing: 9 ^ 4294967293 ---
452int(4294967284)
453--- testing: 9 ^ 9223372036854775806 ---
454int(9223372036854775799)
455--- testing: 9 ^ 9.2233720368548E+18 ---
456int(-9223372036854775799)
457--- testing: 9 ^ -9223372036854775807 ---
458int(-9223372036854775800)
459--- testing: 9 ^ -9.2233720368548E+18 ---
460int(-9223372036854775799)
461--- testing: 65 ^ 9223372036854775807 ---
462int(9223372036854775742)
463--- testing: 65 ^ -9223372036854775808 ---
464int(-9223372036854775743)
465--- testing: 65 ^ 2147483647 ---
466int(2147483582)
467--- testing: 65 ^ -2147483648 ---
468int(-2147483583)
469--- testing: 65 ^ 9223372034707292160 ---
470int(9223372034707292225)
471--- testing: 65 ^ -9223372034707292160 ---
472int(-9223372034707292095)
473--- testing: 65 ^ 2147483648 ---
474int(2147483713)
475--- testing: 65 ^ -2147483649 ---
476int(-2147483714)
477--- testing: 65 ^ 4294967294 ---
478int(4294967231)
479--- testing: 65 ^ 4294967295 ---
480int(4294967230)
481--- testing: 65 ^ 4294967293 ---
482int(4294967228)
483--- testing: 65 ^ 9223372036854775806 ---
484int(9223372036854775743)
485--- testing: 65 ^ 9.2233720368548E+18 ---
486int(-9223372036854775743)
487--- testing: 65 ^ -9223372036854775807 ---
488int(-9223372036854775744)
489--- testing: 65 ^ -9.2233720368548E+18 ---
490int(-9223372036854775743)
491--- testing: -44 ^ 9223372036854775807 ---
492int(-9223372036854775765)
493--- testing: -44 ^ -9223372036854775808 ---
494int(9223372036854775764)
495--- testing: -44 ^ 2147483647 ---
496int(-2147483605)
497--- testing: -44 ^ -2147483648 ---
498int(2147483604)
499--- testing: -44 ^ 9223372034707292160 ---
500int(-9223372034707292204)
501--- testing: -44 ^ -9223372034707292160 ---
502int(9223372034707292116)
503--- testing: -44 ^ 2147483648 ---
504int(-2147483692)
505--- testing: -44 ^ -2147483649 ---
506int(2147483691)
507--- testing: -44 ^ 4294967294 ---
508int(-4294967254)
509--- testing: -44 ^ 4294967295 ---
510int(-4294967253)
511--- testing: -44 ^ 4294967293 ---
512int(-4294967255)
513--- testing: -44 ^ 9223372036854775806 ---
514int(-9223372036854775766)
515--- testing: -44 ^ 9.2233720368548E+18 ---
516int(9223372036854775764)
517--- testing: -44 ^ -9223372036854775807 ---
518int(9223372036854775765)
519--- testing: -44 ^ -9.2233720368548E+18 ---
520int(9223372036854775764)
521--- testing: 2147483647 ^ 9223372036854775807 ---
522int(9223372034707292160)
523--- testing: 2147483647 ^ -9223372036854775808 ---
524int(-9223372034707292161)
525--- testing: 2147483647 ^ 2147483647 ---
526int(0)
527--- testing: 2147483647 ^ -2147483648 ---
528int(-1)
529--- testing: 2147483647 ^ 9223372034707292160 ---
530int(9223372036854775807)
531--- testing: 2147483647 ^ -9223372034707292160 ---
532int(-9223372032559808513)
533--- testing: 2147483647 ^ 2147483648 ---
534int(4294967295)
535--- testing: 2147483647 ^ -2147483649 ---
536int(-4294967296)
537--- testing: 2147483647 ^ 4294967294 ---
538int(2147483649)
539--- testing: 2147483647 ^ 4294967295 ---
540int(2147483648)
541--- testing: 2147483647 ^ 4294967293 ---
542int(2147483650)
543--- testing: 2147483647 ^ 9223372036854775806 ---
544int(9223372034707292161)
545--- testing: 2147483647 ^ 9.2233720368548E+18 ---
546int(-9223372034707292161)
547--- testing: 2147483647 ^ -9223372036854775807 ---
548int(-9223372034707292162)
549--- testing: 2147483647 ^ -9.2233720368548E+18 ---
550int(-9223372034707292161)
551--- testing: 9223372036854775807 ^ 9223372036854775807 ---
552int(0)
553--- testing: 9223372036854775807 ^ -9223372036854775808 ---
554int(-1)
555--- testing: 9223372036854775807 ^ 2147483647 ---
556int(9223372034707292160)
557--- testing: 9223372036854775807 ^ -2147483648 ---
558int(-9223372034707292161)
559--- testing: 9223372036854775807 ^ 9223372034707292160 ---
560int(2147483647)
561--- testing: 9223372036854775807 ^ -9223372034707292160 ---
562int(-2147483649)
563--- testing: 9223372036854775807 ^ 2147483648 ---
564int(9223372034707292159)
565--- testing: 9223372036854775807 ^ -2147483649 ---
566int(-9223372034707292160)
567--- testing: 9223372036854775807 ^ 4294967294 ---
568int(9223372032559808513)
569--- testing: 9223372036854775807 ^ 4294967295 ---
570int(9223372032559808512)
571--- testing: 9223372036854775807 ^ 4294967293 ---
572int(9223372032559808514)
573--- testing: 9223372036854775807 ^ 9223372036854775806 ---
574int(1)
575--- testing: 9223372036854775807 ^ 9.2233720368548E+18 ---
576int(-1)
577--- testing: 9223372036854775807 ^ -9223372036854775807 ---
578int(-2)
579--- testing: 9223372036854775807 ^ -9.2233720368548E+18 ---
580int(-1)
581