1--TEST--
2Bug#48746 - Junction not working properly
3--CREDITS--
4Venkat Raman Don (don.raman@microsoft.com)
5--SKIPIF--
6<?php
7if(substr(PHP_OS, 0, 3) != 'WIN' ) {
8    die('skip windows only test');
9}
10include_once __DIR__ . '/common.inc';
11skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
12?>
13--FILE--
14<?php
15include_once __DIR__ . '/common.inc';
16$mountvol = get_mountvol();
17$old_dir = __DIR__;
18$dirname = __DIR__ . "\\mnt\\test\\directory";
19exec("mkdir " . $dirname, $output, $ret_val);
20chdir(__DIR__ . "\\mnt\\test");
21$drive = substr(__DIR__, 0, 2);
22$pathwithoutdrive = substr(__DIR__, 2);
23$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
24exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
25$fullpath = "mounted_volume" . $pathwithoutdrive;
26exec("mklink /j mklink_junction directory", $output, $ret_val);
27file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
28file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
29print_r(scandir("mklink_junction"));
30print_r(scandir("$fullpath\\mnt\\test\\directory"));
31print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
32unlink("$fullpath\\mnt\\test\\directory\\b.php");
33unlink("mklink_junction\\a.php");
34chdir($old_dir);
35rmdir(__DIR__ . "\\mnt\\test\\directory");
36rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
37rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
38rmdir(__DIR__ . "\\mnt\\test");
39rmdir(__DIR__ . "\\mnt");
40
41?>
42--EXPECT--
43Array
44(
45    [0] => .
46    [1] => ..
47    [2] => a.php
48    [3] => b.php
49)
50Array
51(
52    [0] => .
53    [1] => ..
54    [2] => a.php
55    [3] => b.php
56)
57Array
58(
59    [0] => .
60    [1] => ..
61    [2] => a.php
62    [3] => b.php
63)
64