1--TEST--
2Test file() function : error conditions
3--FILE--
4<?php
5$file_path = __DIR__;
6echo "\n*** Testing error conditions ***\n";
7$file_handle = fopen($file_path."/file.tmp", "w");
8
9$filename = $file_path."/file.tmp";
10try {
11    var_dump( file($filename, 10, NULL) );  //  Incorrect flag
12} catch(ValueError $e) {
13    echo "ValueError: " . $e->getMessage() . "\n";
14}
15try {
16    var_dump( file($filename, FILE_APPEND) );  //  Incorrect flag
17} catch(ValueError $e) {
18    echo "ValueError: " . $e->getMessage() . "\n";
19}
20var_dump( file("temp.tmp") );  // non existing filename
21fclose($file_handle);
22
23echo "\n--- Done ---";
24?>
25--CLEAN--
26<?php
27$file_path = __DIR__;
28unlink($file_path."/file.tmp");
29?>
30--EXPECTF--
31*** Testing error conditions ***
32ValueError: file(): Argument #2 ($flags) must be a valid flag value
33ValueError: file(): Argument #2 ($flags) must be a valid flag value
34
35Warning: file(temp.tmp): Failed to open stream: No such file or directory in %s on line %d
36bool(false)
37
38--- Done ---
39