Annotation of embedaddon/php/ext/standard/tests/file/is_file_variation3.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test is_file() function: usage variations - invalid filenames
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:
10: /* Testing is_file() with invalid arguments -int, float, bool, NULL, resource */
11:
12: $file_path = dirname(__FILE__);
13: $file_handle = fopen($file_path."/is_file_variation3.tmp", "w");
14:
15: echo "*** Testing Invalid file types ***\n";
16: $filenames = array(
17: /* Invalid filenames */
18: -2.34555,
19: " ",
20: "",
21: TRUE,
22: FALSE,
23: NULL,
24: $file_handle,
25:
26: /* scalars */
27: 1234,
28: 0
29: );
30:
31: /* loop through to test each element the above array */
32: foreach( $filenames as $filename ) {
33: var_dump( is_file($filename) );
34: clearstatcache();
35: }
36: fclose($file_handle);
37:
38: echo "\n*** Done ***";
39: ?>
40: --CLEAN--
41: <?php
42: $file_path = dirname(__FILE__);
43: unlink($file_path."/is_file_variation3.tmp");
44: ?>
45: --EXPECTF--
46: *** Testing Invalid file types ***
47: bool(false)
48: bool(false)
49: bool(false)
50: bool(false)
51: bool(false)
52: bool(false)
53:
1.1.1.2 ! misho 54: Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d
1.1 misho 55: NULL
56: bool(false)
57: bool(false)
58:
59: *** Done ***
60:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>