1--TEST--
2Test lstat() and stat() functions: usage variations - effects of is_link()
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7   die('skip.. lstat() not available on 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/* test the effects of is_link() on stats of link */
20
21$file_path = dirname(__FILE__);
22require "$file_path/file.inc";
23
24
25/* create temp file, link */
26$filename = "$file_path/lstat_stat_variation12.tmp";
27$fp = fopen($filename, "w");  // temp file
28fclose($fp);
29
30$linkname = "$file_path/lstat_stat_variation12_link.tmp";
31symlink($filename, $linkname); // temp link
32
33// is_link() on a link
34echo "*** Testing stat() on a link after using is_link() on it ***\n";
35$linkname = "$file_path/lstat_stat_variation12_link.tmp";
36$old_stat = lstat($linkname);
37// clear the stat
38clearstatcache();
39sleep(2);
40var_dump( is_link($linkname) );
41$new_stat = lstat($linkname);
42// compare self stats
43var_dump( compare_self_stat($old_stat) );
44var_dump( compare_self_stat($new_stat) );
45// compare the stat
46var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
47// clear the stat
48clearstatcache();
49
50echo "\n--- Done ---";
51?>
52
53--CLEAN--
54<?php
55$file_path = dirname(__FILE__);
56unlink("$file_path/lstat_stat_variation12_link.tmp");
57unlink("$file_path/lstat_stat_variation12.tmp");
58?>
59--EXPECTF--
60*** Testing stat() on a link after using is_link() on it ***
61bool(true)
62bool(true)
63bool(true)
64bool(true)
65
66--- Done ---
67