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';
11$ret = exec(get_junction().' /? 2>&1', $out);
12if (strpos($out[0], 'recognized')) {
13    die('skip. junction.exe not found in PATH.');
14}
15
16?>
17--FILE--
18<?php
19include_once __DIR__ . '/common.inc';
20$old_dir = __DIR__;
21$dirname = __DIR__ . "\\mnt\\test\\directory";
22exec("mkdir " . $dirname, $output, $ret_val);
23chdir(__DIR__ . "\\mnt\\test");
24exec(get_junction()." junction directory", $output, $ret_val);
25file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
26file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
27include "junction/a.php";
28require_once "junction\\b.php";
29print_r(scandir("junction"));
30unlink("junction\\a.php");
31unlink("junction\\b.php");
32chdir($old_dir);
33rmdir(__DIR__ . "\\mnt\\test\\directory");
34rmdir(__DIR__ . "\\mnt\\test\\junction");
35rmdir(__DIR__ . "\\mnt\\test");
36rmdir(__DIR__ . "\\mnt");
37
38?>
39--EXPECT--
40I am included.
41I am included.
42Array
43(
44    [0] => .
45    [1] => ..
46    [2] => a.php
47    [3] => b.php
48)
49