1--TEST--
2Test parsing of hexadecimal quantities
3--EXTENSIONS--
4zend_test
5--FILE--
6<?php
7
8// This test checks valid formats do not throw any warnings.
9foreach (['', ' '] as $leadingWS) {
10  foreach (['', '+', '-'] as $sign) {
11    foreach (['', ' '] as $midWS) {
12      // Ignore G due to overflow on 32bits
13      foreach (['', 'K', 'k', 'M', 'm'] as $exp) {
14        foreach (['', ' '] as $trailingWS) {
15          $setting = sprintf('%s%s0x1F%s%s%s',
16                             $leadingWS, $sign, $midWS, $exp, $trailingWS);
17          printf("# \"%s\"\n", $setting);
18          var_dump(zend_test_zend_ini_parse_quantity($setting));
19          print "\n";
20
21          $setting = sprintf('%s%s0X1F%s%s%s',
22                             $leadingWS, $sign, $midWS, $exp, $trailingWS);
23          printf("# \"%s\"\n", $setting);
24          var_dump(zend_test_zend_ini_parse_quantity($setting));
25          print "\n";
26        }
27      }
28    }
29  }
30}
31--EXPECT--
32# "0x1F"
33int(31)
34
35# "0X1F"
36int(31)
37
38# "0x1F "
39int(31)
40
41# "0X1F "
42int(31)
43
44# "0x1FK"
45int(31744)
46
47# "0X1FK"
48int(31744)
49
50# "0x1FK "
51int(31744)
52
53# "0X1FK "
54int(31744)
55
56# "0x1Fk"
57int(31744)
58
59# "0X1Fk"
60int(31744)
61
62# "0x1Fk "
63int(31744)
64
65# "0X1Fk "
66int(31744)
67
68# "0x1FM"
69int(32505856)
70
71# "0X1FM"
72int(32505856)
73
74# "0x1FM "
75int(32505856)
76
77# "0X1FM "
78int(32505856)
79
80# "0x1Fm"
81int(32505856)
82
83# "0X1Fm"
84int(32505856)
85
86# "0x1Fm "
87int(32505856)
88
89# "0X1Fm "
90int(32505856)
91
92# "0x1F "
93int(31)
94
95# "0X1F "
96int(31)
97
98# "0x1F  "
99int(31)
100
101# "0X1F  "
102int(31)
103
104# "0x1F K"
105int(31744)
106
107# "0X1F K"
108int(31744)
109
110# "0x1F K "
111int(31744)
112
113# "0X1F K "
114int(31744)
115
116# "0x1F k"
117int(31744)
118
119# "0X1F k"
120int(31744)
121
122# "0x1F k "
123int(31744)
124
125# "0X1F k "
126int(31744)
127
128# "0x1F M"
129int(32505856)
130
131# "0X1F M"
132int(32505856)
133
134# "0x1F M "
135int(32505856)
136
137# "0X1F M "
138int(32505856)
139
140# "0x1F m"
141int(32505856)
142
143# "0X1F m"
144int(32505856)
145
146# "0x1F m "
147int(32505856)
148
149# "0X1F m "
150int(32505856)
151
152# "+0x1F"
153int(31)
154
155# "+0X1F"
156int(31)
157
158# "+0x1F "
159int(31)
160
161# "+0X1F "
162int(31)
163
164# "+0x1FK"
165int(31744)
166
167# "+0X1FK"
168int(31744)
169
170# "+0x1FK "
171int(31744)
172
173# "+0X1FK "
174int(31744)
175
176# "+0x1Fk"
177int(31744)
178
179# "+0X1Fk"
180int(31744)
181
182# "+0x1Fk "
183int(31744)
184
185# "+0X1Fk "
186int(31744)
187
188# "+0x1FM"
189int(32505856)
190
191# "+0X1FM"
192int(32505856)
193
194# "+0x1FM "
195int(32505856)
196
197# "+0X1FM "
198int(32505856)
199
200# "+0x1Fm"
201int(32505856)
202
203# "+0X1Fm"
204int(32505856)
205
206# "+0x1Fm "
207int(32505856)
208
209# "+0X1Fm "
210int(32505856)
211
212# "+0x1F "
213int(31)
214
215# "+0X1F "
216int(31)
217
218# "+0x1F  "
219int(31)
220
221# "+0X1F  "
222int(31)
223
224# "+0x1F K"
225int(31744)
226
227# "+0X1F K"
228int(31744)
229
230# "+0x1F K "
231int(31744)
232
233# "+0X1F K "
234int(31744)
235
236# "+0x1F k"
237int(31744)
238
239# "+0X1F k"
240int(31744)
241
242# "+0x1F k "
243int(31744)
244
245# "+0X1F k "
246int(31744)
247
248# "+0x1F M"
249int(32505856)
250
251# "+0X1F M"
252int(32505856)
253
254# "+0x1F M "
255int(32505856)
256
257# "+0X1F M "
258int(32505856)
259
260# "+0x1F m"
261int(32505856)
262
263# "+0X1F m"
264int(32505856)
265
266# "+0x1F m "
267int(32505856)
268
269# "+0X1F m "
270int(32505856)
271
272# "-0x1F"
273int(-31)
274
275# "-0X1F"
276int(-31)
277
278# "-0x1F "
279int(-31)
280
281# "-0X1F "
282int(-31)
283
284# "-0x1FK"
285int(-31744)
286
287# "-0X1FK"
288int(-31744)
289
290# "-0x1FK "
291int(-31744)
292
293# "-0X1FK "
294int(-31744)
295
296# "-0x1Fk"
297int(-31744)
298
299# "-0X1Fk"
300int(-31744)
301
302# "-0x1Fk "
303int(-31744)
304
305# "-0X1Fk "
306int(-31744)
307
308# "-0x1FM"
309int(-32505856)
310
311# "-0X1FM"
312int(-32505856)
313
314# "-0x1FM "
315int(-32505856)
316
317# "-0X1FM "
318int(-32505856)
319
320# "-0x1Fm"
321int(-32505856)
322
323# "-0X1Fm"
324int(-32505856)
325
326# "-0x1Fm "
327int(-32505856)
328
329# "-0X1Fm "
330int(-32505856)
331
332# "-0x1F "
333int(-31)
334
335# "-0X1F "
336int(-31)
337
338# "-0x1F  "
339int(-31)
340
341# "-0X1F  "
342int(-31)
343
344# "-0x1F K"
345int(-31744)
346
347# "-0X1F K"
348int(-31744)
349
350# "-0x1F K "
351int(-31744)
352
353# "-0X1F K "
354int(-31744)
355
356# "-0x1F k"
357int(-31744)
358
359# "-0X1F k"
360int(-31744)
361
362# "-0x1F k "
363int(-31744)
364
365# "-0X1F k "
366int(-31744)
367
368# "-0x1F M"
369int(-32505856)
370
371# "-0X1F M"
372int(-32505856)
373
374# "-0x1F M "
375int(-32505856)
376
377# "-0X1F M "
378int(-32505856)
379
380# "-0x1F m"
381int(-32505856)
382
383# "-0X1F m"
384int(-32505856)
385
386# "-0x1F m "
387int(-32505856)
388
389# "-0X1F m "
390int(-32505856)
391
392# " 0x1F"
393int(31)
394
395# " 0X1F"
396int(31)
397
398# " 0x1F "
399int(31)
400
401# " 0X1F "
402int(31)
403
404# " 0x1FK"
405int(31744)
406
407# " 0X1FK"
408int(31744)
409
410# " 0x1FK "
411int(31744)
412
413# " 0X1FK "
414int(31744)
415
416# " 0x1Fk"
417int(31744)
418
419# " 0X1Fk"
420int(31744)
421
422# " 0x1Fk "
423int(31744)
424
425# " 0X1Fk "
426int(31744)
427
428# " 0x1FM"
429int(32505856)
430
431# " 0X1FM"
432int(32505856)
433
434# " 0x1FM "
435int(32505856)
436
437# " 0X1FM "
438int(32505856)
439
440# " 0x1Fm"
441int(32505856)
442
443# " 0X1Fm"
444int(32505856)
445
446# " 0x1Fm "
447int(32505856)
448
449# " 0X1Fm "
450int(32505856)
451
452# " 0x1F "
453int(31)
454
455# " 0X1F "
456int(31)
457
458# " 0x1F  "
459int(31)
460
461# " 0X1F  "
462int(31)
463
464# " 0x1F K"
465int(31744)
466
467# " 0X1F K"
468int(31744)
469
470# " 0x1F K "
471int(31744)
472
473# " 0X1F K "
474int(31744)
475
476# " 0x1F k"
477int(31744)
478
479# " 0X1F k"
480int(31744)
481
482# " 0x1F k "
483int(31744)
484
485# " 0X1F k "
486int(31744)
487
488# " 0x1F M"
489int(32505856)
490
491# " 0X1F M"
492int(32505856)
493
494# " 0x1F M "
495int(32505856)
496
497# " 0X1F M "
498int(32505856)
499
500# " 0x1F m"
501int(32505856)
502
503# " 0X1F m"
504int(32505856)
505
506# " 0x1F m "
507int(32505856)
508
509# " 0X1F m "
510int(32505856)
511
512# " +0x1F"
513int(31)
514
515# " +0X1F"
516int(31)
517
518# " +0x1F "
519int(31)
520
521# " +0X1F "
522int(31)
523
524# " +0x1FK"
525int(31744)
526
527# " +0X1FK"
528int(31744)
529
530# " +0x1FK "
531int(31744)
532
533# " +0X1FK "
534int(31744)
535
536# " +0x1Fk"
537int(31744)
538
539# " +0X1Fk"
540int(31744)
541
542# " +0x1Fk "
543int(31744)
544
545# " +0X1Fk "
546int(31744)
547
548# " +0x1FM"
549int(32505856)
550
551# " +0X1FM"
552int(32505856)
553
554# " +0x1FM "
555int(32505856)
556
557# " +0X1FM "
558int(32505856)
559
560# " +0x1Fm"
561int(32505856)
562
563# " +0X1Fm"
564int(32505856)
565
566# " +0x1Fm "
567int(32505856)
568
569# " +0X1Fm "
570int(32505856)
571
572# " +0x1F "
573int(31)
574
575# " +0X1F "
576int(31)
577
578# " +0x1F  "
579int(31)
580
581# " +0X1F  "
582int(31)
583
584# " +0x1F K"
585int(31744)
586
587# " +0X1F K"
588int(31744)
589
590# " +0x1F K "
591int(31744)
592
593# " +0X1F K "
594int(31744)
595
596# " +0x1F k"
597int(31744)
598
599# " +0X1F k"
600int(31744)
601
602# " +0x1F k "
603int(31744)
604
605# " +0X1F k "
606int(31744)
607
608# " +0x1F M"
609int(32505856)
610
611# " +0X1F M"
612int(32505856)
613
614# " +0x1F M "
615int(32505856)
616
617# " +0X1F M "
618int(32505856)
619
620# " +0x1F m"
621int(32505856)
622
623# " +0X1F m"
624int(32505856)
625
626# " +0x1F m "
627int(32505856)
628
629# " +0X1F m "
630int(32505856)
631
632# " -0x1F"
633int(-31)
634
635# " -0X1F"
636int(-31)
637
638# " -0x1F "
639int(-31)
640
641# " -0X1F "
642int(-31)
643
644# " -0x1FK"
645int(-31744)
646
647# " -0X1FK"
648int(-31744)
649
650# " -0x1FK "
651int(-31744)
652
653# " -0X1FK "
654int(-31744)
655
656# " -0x1Fk"
657int(-31744)
658
659# " -0X1Fk"
660int(-31744)
661
662# " -0x1Fk "
663int(-31744)
664
665# " -0X1Fk "
666int(-31744)
667
668# " -0x1FM"
669int(-32505856)
670
671# " -0X1FM"
672int(-32505856)
673
674# " -0x1FM "
675int(-32505856)
676
677# " -0X1FM "
678int(-32505856)
679
680# " -0x1Fm"
681int(-32505856)
682
683# " -0X1Fm"
684int(-32505856)
685
686# " -0x1Fm "
687int(-32505856)
688
689# " -0X1Fm "
690int(-32505856)
691
692# " -0x1F "
693int(-31)
694
695# " -0X1F "
696int(-31)
697
698# " -0x1F  "
699int(-31)
700
701# " -0X1F  "
702int(-31)
703
704# " -0x1F K"
705int(-31744)
706
707# " -0X1F K"
708int(-31744)
709
710# " -0x1F K "
711int(-31744)
712
713# " -0X1F K "
714int(-31744)
715
716# " -0x1F k"
717int(-31744)
718
719# " -0X1F k"
720int(-31744)
721
722# " -0x1F k "
723int(-31744)
724
725# " -0X1F k "
726int(-31744)
727
728# " -0x1F M"
729int(-32505856)
730
731# " -0X1F M"
732int(-32505856)
733
734# " -0x1F M "
735int(-32505856)
736
737# " -0X1F M "
738int(-32505856)
739
740# " -0x1F m"
741int(-32505856)
742
743# " -0X1F m"
744int(-32505856)
745
746# " -0x1F m "
747int(-32505856)
748
749# " -0X1F m "
750int(-32505856)
751