1--TEST--
2Test rename() function: usage variations-6
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') die('skip..  for Windows');
6if (!function_exists("symlink")) die("skip symlinks are not supported");
7$fn = "rename_variation6tmp.lnk";
8$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out);
9@unlink($fn);
10if (strpos($ret, 'privilege')) {
11	die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
12}
13?>
14--FILE--
15<?php
16
17$tmp_file = __FILE__.".tmp";
18$tmp_link = __FILE__.".tmp.link";
19$tmp_link2 = __FILE__.".tmp.link2";
20
21touch($tmp_file);
22symlink($tmp_file, $tmp_link);
23rename($tmp_link, $tmp_link2);
24
25clearstatcache();
26
27var_dump(readlink($tmp_link));
28var_dump(readlink($tmp_link2));
29var_dump(file_exists($tmp_file));
30
31@unlink($tmp_link);
32@unlink($tmp_link2);
33@unlink($tmp_file);
34
35echo "Done\n";
36?>
37--EXPECTF--
38Warning: readlink(): %s in %s on line %d
39bool(false)
40string(%d) "%srename_variation6-win32.php.tmp"
41bool(true)
42Done
43