1--TEST--
2Test fileperms() function: usage variations - diff. path notations
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--FILE--
6<?php
7/* Prototype: int fileperms ( string $filename )
8 * Description: Returns the group ID of the file, or FALSE in case of an error.
9 */
10
11/* Passing file names with different notations, using slashes, wild-card chars */
12
13$file_path = dirname(__FILE__);
14
15echo "*** Testing fileperms() with different notations of file names ***\n";
16$dir_name = $file_path."/fileperms_variation3";
17mkdir($dir_name);
18$file_handle = fopen($dir_name."/fileperms_variation3.tmp", "w");
19fclose($file_handle);
20
21$files_arr = array(
22  "/fileperms_variation3/fileperms_variation3.tmp",
23
24  /* Testing a file trailing slash */
25  "/fileperms_variation3/fileperms_variation3.tmp/",
26
27  /* Testing file with double slashes */
28  "/fileperms_variation3//fileperms_variation3.tmp",
29  "//fileperms_variation3//fileperms_variation3.tmp",
30  "/fileperms_variation3/*.tmp",
31  "fileperms_variation3/fileperms*.tmp",
32
33  /* Testing Binary safe */
34  "/fileperms_variation3/fileperms_variation3.tmp".chr(0),
35  "/fileperms_variation3/fileperms_variation3.tmp\0"
36);
37
38$count = 1;
39/* loop through to test each element in the above array */
40foreach($files_arr as $file) {
41  echo "- Iteration $count -\n";
42  var_dump( fileperms( $file_path."/".$file ) );
43  clearstatcache();
44  $count++;
45}
46
47echo "\n*** Done ***";
48?>
49--CLEAN--
50<?php
51$file_path = dirname(__FILE__);
52$dir_name = $file_path."/fileperms_variation3";
53unlink($dir_name."/fileperms_variation3.tmp");
54rmdir($dir_name);
55?>
56--EXPECTF--
57*** Testing fileperms() with different notations of file names ***
58- Iteration 1 -
59int(%d)
60- Iteration 2 -
61
62Warning: fileperms(): stat failed for %s//fileperms_variation3/fileperms_variation3.tmp/ in %s on line %d
63bool(false)
64- Iteration 3 -
65int(%d)
66- Iteration 4 -
67int(%d)
68- Iteration 5 -
69
70Warning: fileperms(): stat failed for %s//fileperms_variation3/*.tmp in %s on line %d
71bool(false)
72- Iteration 6 -
73
74Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d
75bool(false)
76- Iteration 7 -
77bool(false)
78- Iteration 8 -
79bool(false)
80
81*** Done ***
82