1--TEST--
2Test lstat() and stat() functions: usage variations - creating file/subdir
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 on stats with creating file/subdir in a dir
23*/
24
25/* create temp file */
26mkdir("$file_path/lstat_stat_variation8/");  // temp dir
27
28// creating and deleting subdir and files in the dir
29echo "*** Testing stat() on dir after subdir and file is created in it ***\n";
30$dirname = "$file_path/lstat_stat_variation8";
31$old_stat = stat($dirname);
32clearstatcache();
33sleep(2);
34mkdir("$dirname/lstat_stat_variation8_subdir");
35$file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w");
36fclose($file_handle);
37$new_stat = stat($dirname);
38
39// compare self stats
40var_dump( compare_self_stat($old_stat) );
41var_dump( compare_self_stat($new_stat) );
42// compare the stats
43$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime');
44clearstatcache();
45var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
46
47echo "\n--- Done ---";
48?>
49--CLEAN--
50<?php
51$file_path = dirname(__FILE__);
52unlink("$file_path/lstat_stat_variation8/lstat_stat_variation8a.tmp");
53rmdir("$file_path/lstat_stat_variation8/lstat_stat_variation8_subdir/");
54rmdir("$file_path/lstat_stat_variation8");
55?>
56--EXPECTF--
57*** Testing stat() on dir after subdir and file is created in it ***
58bool(true)
59bool(true)
60bool(true)
61
62--- Done ---
63