1--TEST--
2Test fileatime(), filemtime(), filectime() & touch() functions : usage variation
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--SKIPIF--
6<?php
7if (substr(PHP_OS, 0, 3) != 'WIN') {
8    die('skip.. only for Windows');
9}
10?>
11--FILE--
12<?php
13
14function stat_fn( $filename ) {
15  echo "\n-- File '$filename' --\n";
16  echo "-- File access time is => ";
17  echo fileatime($filename)."\n";
18  clearstatcache();
19  echo "-- File modification time is => ";
20  echo filemtime($filename)."\n";
21  clearstatcache();
22  echo "-- inode change time is => ";
23  echo filectime($filename)."\n";
24  clearstatcache();
25
26
27}
28
29echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
30echo "\n*** testing file info ***";
31stat_fn(false);
32stat_fn('');
33stat_fn(' ');
34stat_fn('|');
35echo "\n*** testing touch ***\n";
36var_dump(touch(false));
37var_dump(touch(''));
38
39//php generates permission denied, we generate No such file or dir.
40var_dump(touch(' '));
41var_dump(touch('|'));
42
43
44echo "Done";
45?>
46--EXPECTF--
47*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
48
49*** testing file info ***
50-- File '' --
51-- File access time is =>
52-- File modification time is =>
53-- inode change time is =>
54
55-- File '' --
56-- File access time is =>
57-- File modification time is =>
58-- inode change time is =>
59
60-- File ' ' --
61-- File access time is =>
62Warning: fileatime(): stat failed for   in %s on line %d
63
64-- File modification time is =>
65Warning: filemtime(): stat failed for   in %s on line %d
66
67-- inode change time is =>
68Warning: filectime(): stat failed for   in %s on line %d
69
70
71-- File '|' --
72-- File access time is =>
73Warning: fileatime(): stat failed for | in %s on line %d
74
75-- File modification time is =>
76Warning: filemtime(): stat failed for | in %s on line %d
77
78-- inode change time is =>
79Warning: filectime(): stat failed for | in %s on line %d
80
81
82*** testing touch ***
83bool(false)
84bool(false)
85
86Warning: touch(): %s in %s on line %d
87bool(false)
88
89Warning: touch(): %s in %s on line %d
90bool(false)
91Done
92