1--TEST--
2Test lstat() and stat() functions: usage variations - effect of is_file()
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7    die('skip.. Not valid for Windows');
8}
9?>
10--FILE--
11<?php
12/* Prototype: array lstat ( string $filename );
13   Description: Gives information about a file or symbolic link
14
15   Prototype: array stat ( string $filename );
16   Description: Gives information about a file
17*/
18
19$file_path = dirname(__FILE__);
20require "$file_path/file.inc";
21
22/* test the effects of is_file() on stats of a file */
23
24/* create temp file */
25$filename = "$file_path/lstat_stat_variation11.tmp";
26$fp = fopen($filename, "w");  // temp file
27fclose($fp);
28
29// is_file() on a file
30echo "*** Testing stat() on a file after using is_file() on it ***\n";
31$old_stat = stat($filename);
32// clear the stat
33clearstatcache();
34sleep(2);
35var_dump( is_file($filename) );
36$new_stat = stat($filename);
37// compare self stats
38var_dump( compare_self_stat($old_stat) );
39var_dump( compare_self_stat($new_stat) );
40// compare the stat
41var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
42// clear the stat
43clearstatcache();
44
45echo "\n--- Done ---";
46?>
47
48--CLEAN--
49<?php
50$file_path = dirname(__FILE__);
51unlink("$file_path/lstat_stat_variation11.tmp");
52?>
53--EXPECTF--
54*** Testing stat() on a file after using is_file() on it ***
55bool(true)
56bool(true)
57bool(true)
58bool(true)
59
60--- Done ---
61