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(NULL); 32stat_fn(false); 33stat_fn(''); 34stat_fn(' '); 35stat_fn('|'); 36echo "\n*** testing touch ***"; 37var_dump(touch(NULL)); 38var_dump(touch(false)); 39var_dump(touch('')); 40 41//php generates permission denied, we generate No such file or dir. 42var_dump(touch(' ')); 43var_dump(touch('|')); 44 45 46echo "Done"; 47?> 48--EXPECTF-- 49*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** 50 51*** testing file info *** 52-- File '' -- 53-- File access time is => 54-- File modification time is => 55-- inode change time is => 56 57-- File '' -- 58-- File access time is => 59-- File modification time is => 60-- inode change time is => 61 62-- File '' -- 63-- File access time is => 64-- File modification time is => 65-- inode change time is => 66 67-- File ' ' -- 68-- File access time is => 69Warning: fileatime(): stat failed for in %s on line %d 70 71-- File modification time is => 72Warning: filemtime(): stat failed for in %s on line %d 73 74-- inode change time is => 75Warning: filectime(): stat failed for in %s on line %d 76 77 78-- File '|' -- 79-- File access time is => 80Warning: fileatime(): stat failed for | in %s on line %d 81 82-- File modification time is => 83Warning: filemtime(): stat failed for | in %s on line %d 84 85-- inode change time is => 86Warning: filectime(): stat failed for | in %s on line %d 87 88 89*** testing touch ***bool(false) 90bool(false) 91bool(false) 92 93Warning: touch(): %s in %s on line %d 94bool(false) 95 96Warning: touch(): %s in %s on line %d 97bool(false) 98Done 99