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