xref: /PHP-5.3/ext/standard/tests/file/bug47767.phpt (revision 6c2f62c7)
1--TEST--
2bug #47767 (include_once does not resolve windows symlinks or junctions)
3--CREDITS--
4Venkat Raman Don
5--SKIPIF--
6<?php
7if(substr(PHP_OS, 0, 3) != 'WIN' ) {
8		die('skip windows only test');
9}
10if(PHP_WINDOWS_VERSION_MAJOR < 6)  {
11        die('skip windows version 6.0+ only test');
12}
13
14$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out);
15if (strpos($ret, 'privilege')) {
16	die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
17}
18?>
19--FILE--
20<?php
21echo "Testing include_once using file symbolic link\n";
22$filename = __DIR__ . '\\a.php';
23$content = '<?php echo "I am included\n" ?>';
24file_put_contents($filename, $content);
25$softlinkname = __DIR__ . '\\a_slink.php';
26symlink($filename, $softlinkname);
27include_once("$filename");
28include_once("$softlinkname");
29include_once("$softlinkname");
30
31echo "Testing include_once using directory symbolic link\n";
32$softdirlinkname = __DIR__ . "\\a_dir";
33symlink(__DIR__, $softdirlinkname);
34include_once("$softdirlinkname" . '\\a.php');
35
36echo "Testing include_once using junction points\n";
37$junctionname = __DIR__ . '\\a_jdir';
38exec("mklink /J $junctionname " . __DIR__);
39include_once("$junctionname" . '\\a.php');
40
41unlink($filename);
42unlink($softlinkname);
43rmdir($softdirlinkname);
44rmdir($junctionname);
45?>
46--EXPECT--
47Testing include_once using file symbolic link
48I am included
49Testing include_once using directory symbolic link
50Testing include_once using junction points