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