1--TEST-- 2file() with a range of integer flag values 3--FILE-- 4<?php 5 6$filepath = __FILE__ . ".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 19unlink($filepath); 20 21?> 22--EXPECT-- 23array(3) { 24 [0]=> 25 string(7) "Line 1 26" 27 [1]=> 28 string(7) "Line 2 29" 30 [2]=> 31 string(6) "Line 3" 32} 33array(3) { 34 [0]=> 35 string(7) "Line 1 36" 37 [1]=> 38 string(7) "Line 2 39" 40 [2]=> 41 string(6) "Line 3" 42} 43array(3) { 44 [0]=> 45 string(6) "Line 1" 46 [1]=> 47 string(6) "Line 2" 48 [2]=> 49 string(6) "Line 3" 50} 51array(3) { 52 [0]=> 53 string(6) "Line 1" 54 [1]=> 55 string(6) "Line 2" 56 [2]=> 57 string(6) "Line 3" 58} 59array(3) { 60 [0]=> 61 string(7) "Line 1 62" 63 [1]=> 64 string(7) "Line 2 65" 66 [2]=> 67 string(6) "Line 3" 68} 69array(3) { 70 [0]=> 71 string(7) "Line 1 72" 73 [1]=> 74 string(7) "Line 2 75" 76 [2]=> 77 string(6) "Line 3" 78} 79array(3) { 80 [0]=> 81 string(6) "Line 1" 82 [1]=> 83 string(6) "Line 2" 84 [2]=> 85 string(6) "Line 3" 86} 87array(3) { 88 [0]=> 89 string(6) "Line 1" 90 [1]=> 91 string(6) "Line 2" 92 [2]=> 93 string(6) "Line 3" 94} 95array(3) { 96 [0]=> 97 string(7) "Line 1 98" 99 [1]=> 100 string(7) "Line 2 101" 102 [2]=> 103 string(6) "Line 3" 104} 105array(3) { 106 [0]=> 107 string(7) "Line 1 108" 109 [1]=> 110 string(7) "Line 2 111" 112 [2]=> 113 string(6) "Line 3" 114} 115array(3) { 116 [0]=> 117 string(6) "Line 1" 118 [1]=> 119 string(6) "Line 2" 120 [2]=> 121 string(6) "Line 3" 122} 123array(3) { 124 [0]=> 125 string(6) "Line 1" 126 [1]=> 127 string(6) "Line 2" 128 [2]=> 129 string(6) "Line 3" 130} 131array(3) { 132 [0]=> 133 string(7) "Line 1 134" 135 [1]=> 136 string(7) "Line 2 137" 138 [2]=> 139 string(6) "Line 3" 140} 141array(3) { 142 [0]=> 143 string(7) "Line 1 144" 145 [1]=> 146 string(7) "Line 2 147" 148 [2]=> 149 string(6) "Line 3" 150} 151array(3) { 152 [0]=> 153 string(6) "Line 1" 154 [1]=> 155 string(6) "Line 2" 156 [2]=> 157 string(6) "Line 3" 158} 159array(3) { 160 [0]=> 161 string(6) "Line 1" 162 [1]=> 163 string(6) "Line 2" 164 [2]=> 165 string(6) "Line 3" 166} 167array(3) { 168 [0]=> 169 string(7) "Line 1 170" 171 [1]=> 172 string(7) "Line 2 173" 174 [2]=> 175 string(6) "Line 3" 176} 177array(3) { 178 [0]=> 179 string(7) "Line 1 180" 181 [1]=> 182 string(7) "Line 2 183" 184 [2]=> 185 string(6) "Line 3" 186} 187array(3) { 188 [0]=> 189 string(6) "Line 1" 190 [1]=> 191 string(6) "Line 2" 192 [2]=> 193 string(6) "Line 3" 194} 195array(3) { 196 [0]=> 197 string(6) "Line 1" 198 [1]=> 199 string(6) "Line 2" 200 [2]=> 201 string(6) "Line 3" 202} 203array(3) { 204 [0]=> 205 string(7) "Line 1 206" 207 [1]=> 208 string(7) "Line 2 209" 210 [2]=> 211 string(6) "Line 3" 212} 213array(3) { 214 [0]=> 215 string(7) "Line 1 216" 217 [1]=> 218 string(7) "Line 2 219" 220 [2]=> 221 string(6) "Line 3" 222} 223array(3) { 224 [0]=> 225 string(6) "Line 1" 226 [1]=> 227 string(6) "Line 2" 228 [2]=> 229 string(6) "Line 3" 230} 231array(3) { 232 [0]=> 233 string(6) "Line 1" 234 [1]=> 235 string(6) "Line 2" 236 [2]=> 237 string(6) "Line 3" 238} 239file(): Argument #2 ($flags) must be a valid flag value 240file(): Argument #2 ($flags) must be a valid flag value 241file(): Argument #2 ($flags) must be a valid flag value 242file(): Argument #2 ($flags) must be a valid flag value 243file(): Argument #2 ($flags) must be a valid flag value 244file(): Argument #2 ($flags) must be a valid flag value 245file(): Argument #2 ($flags) must be a valid flag value 246file(): Argument #2 ($flags) must be a valid flag value 247file(): Argument #2 ($flags) must be a valid flag value 248