1--TEST--
2file() with a range of integer flag values
3--FILE--
4<?php
5
6$filepath = __DIR__ . '/file_variation_6.tmp';
7$fd = fopen($filepath, "w+");
8fwrite($fd, "Line 1\nLine 2\nLine 3");
9fclose($fd);
10
11for ($flags = 0; $flags <= 32; $flags++) {
12    try {
13        var_dump(file($filepath, $flags));
14    } catch (\ValueError $e) {
15        echo $e->getMessage() . \PHP_EOL;
16    }
17}
18
19?>
20--CLEAN--
21<?php
22$filepath = __DIR__ . '/file_variation_6.tmp';
23unlink($filepath);
24?>
25--EXPECT--
26array(3) {
27  [0]=>
28  string(7) "Line 1
29"
30  [1]=>
31  string(7) "Line 2
32"
33  [2]=>
34  string(6) "Line 3"
35}
36array(3) {
37  [0]=>
38  string(7) "Line 1
39"
40  [1]=>
41  string(7) "Line 2
42"
43  [2]=>
44  string(6) "Line 3"
45}
46array(3) {
47  [0]=>
48  string(6) "Line 1"
49  [1]=>
50  string(6) "Line 2"
51  [2]=>
52  string(6) "Line 3"
53}
54array(3) {
55  [0]=>
56  string(6) "Line 1"
57  [1]=>
58  string(6) "Line 2"
59  [2]=>
60  string(6) "Line 3"
61}
62array(3) {
63  [0]=>
64  string(7) "Line 1
65"
66  [1]=>
67  string(7) "Line 2
68"
69  [2]=>
70  string(6) "Line 3"
71}
72array(3) {
73  [0]=>
74  string(7) "Line 1
75"
76  [1]=>
77  string(7) "Line 2
78"
79  [2]=>
80  string(6) "Line 3"
81}
82array(3) {
83  [0]=>
84  string(6) "Line 1"
85  [1]=>
86  string(6) "Line 2"
87  [2]=>
88  string(6) "Line 3"
89}
90array(3) {
91  [0]=>
92  string(6) "Line 1"
93  [1]=>
94  string(6) "Line 2"
95  [2]=>
96  string(6) "Line 3"
97}
98file(): Argument #2 ($flags) must be a valid flag value
99file(): Argument #2 ($flags) must be a valid flag value
100file(): Argument #2 ($flags) must be a valid flag value
101file(): Argument #2 ($flags) must be a valid flag value
102file(): Argument #2 ($flags) must be a valid flag value
103file(): Argument #2 ($flags) must be a valid flag value
104file(): Argument #2 ($flags) must be a valid flag value
105file(): Argument #2 ($flags) must be a valid flag value
106array(3) {
107  [0]=>
108  string(7) "Line 1
109"
110  [1]=>
111  string(7) "Line 2
112"
113  [2]=>
114  string(6) "Line 3"
115}
116array(3) {
117  [0]=>
118  string(7) "Line 1
119"
120  [1]=>
121  string(7) "Line 2
122"
123  [2]=>
124  string(6) "Line 3"
125}
126array(3) {
127  [0]=>
128  string(6) "Line 1"
129  [1]=>
130  string(6) "Line 2"
131  [2]=>
132  string(6) "Line 3"
133}
134array(3) {
135  [0]=>
136  string(6) "Line 1"
137  [1]=>
138  string(6) "Line 2"
139  [2]=>
140  string(6) "Line 3"
141}
142array(3) {
143  [0]=>
144  string(7) "Line 1
145"
146  [1]=>
147  string(7) "Line 2
148"
149  [2]=>
150  string(6) "Line 3"
151}
152array(3) {
153  [0]=>
154  string(7) "Line 1
155"
156  [1]=>
157  string(7) "Line 2
158"
159  [2]=>
160  string(6) "Line 3"
161}
162array(3) {
163  [0]=>
164  string(6) "Line 1"
165  [1]=>
166  string(6) "Line 2"
167  [2]=>
168  string(6) "Line 3"
169}
170array(3) {
171  [0]=>
172  string(6) "Line 1"
173  [1]=>
174  string(6) "Line 2"
175  [2]=>
176  string(6) "Line 3"
177}
178file(): Argument #2 ($flags) must be a valid flag value
179file(): Argument #2 ($flags) must be a valid flag value
180file(): Argument #2 ($flags) must be a valid flag value
181file(): Argument #2 ($flags) must be a valid flag value
182file(): Argument #2 ($flags) must be a valid flag value
183file(): Argument #2 ($flags) must be a valid flag value
184file(): Argument #2 ($flags) must be a valid flag value
185file(): Argument #2 ($flags) must be a valid flag value
186file(): Argument #2 ($flags) must be a valid flag value
187