File tree Expand file tree Collapse file tree 1 file changed +102
-0
lines changed
ext/standard/tests/array/range Expand file tree Collapse file tree 1 file changed +102
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test range() function with null as argument.
3
+ --INI--
4
+ serialize_precision=14
5
+ --FILE--
6
+ <?php
7
+
8
+ echo "null with int boundary \n" ;
9
+ var_dump ( range (null , 5 ) );
10
+ var_dump ( range (5 , null ) );
11
+
12
+ echo "null with float boundary \n" ;
13
+ var_dump ( range (null , 4.5 ) );
14
+ var_dump ( range (4.5 , null ) );
15
+
16
+ echo "null with string boundary \n" ;
17
+ var_dump ( range (null , 'e ' ) );
18
+ var_dump ( range ('e ' , null ) );
19
+
20
+ echo "Done \n" ;
21
+ ?>
22
+ --EXPECTF--
23
+ null with int boundary
24
+
25
+ Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
26
+ array(6) {
27
+ [0]=>
28
+ int(0)
29
+ [1]=>
30
+ int(1)
31
+ [2]=>
32
+ int(2)
33
+ [3]=>
34
+ int(3)
35
+ [4]=>
36
+ int(4)
37
+ [5]=>
38
+ int(5)
39
+ }
40
+
41
+ Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
42
+ array(6) {
43
+ [0]=>
44
+ int(5)
45
+ [1]=>
46
+ int(4)
47
+ [2]=>
48
+ int(3)
49
+ [3]=>
50
+ int(2)
51
+ [4]=>
52
+ int(1)
53
+ [5]=>
54
+ int(0)
55
+ }
56
+ null with float boundary
57
+
58
+ Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
59
+ array(5) {
60
+ [0]=>
61
+ float(0)
62
+ [1]=>
63
+ float(1)
64
+ [2]=>
65
+ float(2)
66
+ [3]=>
67
+ float(3)
68
+ [4]=>
69
+ float(4)
70
+ }
71
+
72
+ Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
73
+ array(5) {
74
+ [0]=>
75
+ float(4.5)
76
+ [1]=>
77
+ float(3.5)
78
+ [2]=>
79
+ float(2.5)
80
+ [3]=>
81
+ float(1.5)
82
+ [4]=>
83
+ float(0.5)
84
+ }
85
+ null with string boundary
86
+
87
+ Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
88
+
89
+ Warning: range(): Argument #1 ($start) must be a string if argument #2 ($end) is a string, argument #2 ($end) converted to 0 in %s on line %d
90
+ array(1) {
91
+ [0]=>
92
+ int(0)
93
+ }
94
+
95
+ Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
96
+
97
+ Warning: range(): Argument #2 ($end) must be a string if argument #1 ($start) is a string, argument #1 ($start) converted to 0 in %s on line %d
98
+ array(1) {
99
+ [0]=>
100
+ int(0)
101
+ }
102
+ Done
You can’t perform that action at this time.
0 commit comments