]> granicus.if.org Git - php/blob
c5843a5abf
[php] /
1 --TEST--
2 Test is_writable() and its alias is_writeable() function: usage variations - invalid file names
3 --SKIPIF--
4 <?php
5 require __DIR__ . '/../skipif_root.inc';
6 ?>
7 --CONFLICTS--
8 obscure_filename
9 --FILE--
10 <?php
11 /* Prototype: bool is_writable ( string $filename );
12    Description: Tells whether the filename is writable.
13
14    is_writeable() is an alias of is_writable()
15 */
16
17 /* test is_writable() & is_writeable() with invalid arguments */
18
19 echo "*** Testing is_writable(): usage variations ***\n";
20
21 echo "\n*** Testing is_writable() with invalid filenames ***\n";
22 $misc_files = array(
23   0,
24   1234,
25   -2.34555,
26   TRUE,
27   FALSE,
28   NULL,
29   " ",
30   @$file_handle
31 );
32 /* loop through to test each element in the above array
33    is a writable file */
34 foreach( $misc_files as $misc_file ) {
35   var_dump( is_writable($misc_file) );
36   var_dump( is_writeable($misc_file) );
37   clearstatcache();
38 }
39 ?>
40 --EXPECTF--
41 *** Testing is_writable(): usage variations ***
42
43 *** Testing is_writable() with invalid 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 bool(false)
53 bool(false)
54 bool(false)
55 bool(false)
56 bool(false)
57 bool(false)
58 bool(false)
59 bool(false)