1--TEST--
2Test lstat() and stat() functions: usage variations - file opened using w and r mode
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/* use stat on file created using "w" and "r" mode of fopen */
20
21$file_path = dirname(__FILE__);
22require "$file_path/file.inc";
23
24
25$filename = "$file_path/lstat_stat_variation13.tmp";
26
27echo "*** Checking stat() on a file opened using read/write mode ***\n";
28$file_handle = fopen($filename, "w");  // create file
29fclose($file_handle);
30$old_stat = stat($filename);
31// clear the stat
32clearstatcache();
33sleep(2);
34// opening file again in read mode
35$file_handle = fopen($filename, "r");  // read file
36fclose($file_handle);
37$new_stat = stat($filename);
38// compare self stats
39var_dump( compare_self_stat($old_stat) );
40var_dump( compare_self_stat($new_stat) );
41// compare the stat
42var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
43
44echo "\n--- Done ---";
45?>
46
47--CLEAN--
48<?php
49$file_path = dirname(__FILE__);
50unlink("$file_path/lstat_stat_variation13.tmp");
51?>
52--EXPECTF--
53*** Checking stat() on a file opened using read/write mode ***
54bool(true)
55bool(true)
56bool(true)
57
58--- Done ---
59