1--TEST--
2Test fileperms() function: usage variations - invalid filenames
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--CONFLICTS--
6obscure_filename
7--FILE--
8<?php
9/* Prototype: int fileperms ( string $filename )
10 * Description: Returns the group ID of the file, or FALSE in case of an error.
11 */
12
13/* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */
14
15$file_path = __DIR__;
16$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w");
17
18echo "*** Testing Invalid file types ***\n";
19$filenames = array(
20  /* Invalid filenames */
21  -2.34555,
22  " ",
23  "",
24  TRUE,
25  FALSE,
26  NULL,
27  $file_handle,
28
29  /* scalars */
30  1234,
31  0
32);
33
34/* loop through to test each element the above array */
35foreach( $filenames as $filename ) {
36  var_dump( fileperms($filename) );
37  clearstatcache();
38}
39fclose($file_handle);
40?>
41--CLEAN--
42<?php
43$file_path = __DIR__;
44unlink($file_path."/fileperms_variation2.tmp");
45?>
46--EXPECTF--
47*** Testing Invalid file types ***
48
49Warning: fileperms(): stat failed for -2.34555 in %s on line %d
50bool(false)
51
52Warning: fileperms(): stat failed for   in %s on line %d
53bool(false)
54bool(false)
55
56Warning: fileperms(): stat failed for 1 in %s on line %d
57bool(false)
58bool(false)
59bool(false)
60
61Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d
62NULL
63
64Warning: fileperms(): stat failed for 1234 in %s on line %d
65bool(false)
66
67Warning: fileperms(): stat failed for 0 in %s on line %d
68bool(false)
69