]> granicus.if.org Git - php/blob
97c794d1b7
[php] /
1 --TEST--
2 Test is_readable() function: usage variations - invalid file names
3 --SKIPIF--
4 <?php
5 require __DIR__ . '/../skipif_root.inc';
6 ?>
7 --FILE--
8 <?php
9 /* Prototype: bool is_readable ( string $filename );
10    Description: Tells whether the filename is readable.
11 */
12
13 /* test is_executable() with invalid arguments */
14
15 echo "*** Testing is_readable(): usage variations ***\n";
16
17 $file_handle = fopen(__FILE__, "r");
18 unset($file_handle);
19
20 echo "\n*** Testing is_readable() on miscellaneous filenames ***\n";
21 $misc_files = array(
22   0,
23   1234,
24   -2.34555,
25   TRUE,
26   FALSE,
27   NULL,
28   " ",
29   @$file_handle
30 );
31 /* loop through to test each element in the above array
32    is a readable file */
33 foreach( $misc_files as $misc_file ) {
34   var_dump( is_readable($misc_file) );
35   clearstatcache();
36 }
37
38 echo "Done\n";
39 ?>
40 --EXPECTF--
41 *** Testing is_readable(): usage variations ***
42
43 *** Testing is_readable() on miscellaneous filenames ***
44 bool(false)
45 bool(false)
46 bool(false)
47 bool(false)
48 bool(false)
49 bool(false)
50 bool(false)
51 bool(false)
52 Done