1--TEST--
2Test is_file() function: error conditions
3--FILE--
4<?php
5/* Prototype: bool is_file ( string $filename );
6   Description: Tells whether the filename is a regular file
7                Returns TRUE if the filename exists and is a regular file
8*/
9
10echo "*** Testing is_file() error conditions ***";
11$file_path = dirname(__FILE__);
12var_dump( is_file() );  // Zero No. of args
13
14/* no of args > expected */
15$file_handle = fopen($file_path."/is_file_error.tmp", "w");
16var_dump( is_file( $file_path."/is_file_error.tmp", $file_path."/is_file_error1.tmp") );
17
18/* Non-existing file */
19var_dump( is_file($file_path."/is_file_error1.tmp") );
20
21/* Passing resource as an argument */
22var_dump( is_file($file_handle) );
23
24fclose($file_handle);
25
26echo "\n*** Done ***";
27?>
28
29--CLEAN--
30<?php
31$file_path = dirname(__FILE__);
32if(file_exists($file_path."/is_file_error.tmp")) {
33  unlink($file_path."/is_file_error.tmp");
34}
35if(file_exists($file_path."/is_file_error1.tmp")) {
36  unlink($file_path."/is_file_error1.tmp");
37}
38?>
39--EXPECTF--
40*** Testing is_file() error conditions ***
41Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d
42NULL
43
44Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d
45NULL
46bool(false)
47
48Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d
49NULL
50
51*** Done ***
52