xref: /php-src/ext/standard/tests/file/bug47767.phpt (revision c5401854)
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}
10include_once __DIR__ . '/windows_links/common.inc';
11skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
12?>
13--FILE--
14<?php
15echo "Testing include_once using file symbolic link\n";
16$filename = __DIR__ . '\\a.php';
17$content = '<?php echo "I am included\n" ?>';
18file_put_contents($filename, $content);
19$softlinkname = __DIR__ . '\\a_slink.php';
20symlink($filename, $softlinkname);
21include_once("$filename");
22include_once("$softlinkname");
23include_once("$softlinkname");
24
25echo "Testing include_once using directory symbolic link\n";
26$softdirlinkname = __DIR__ . "\\a_dir";
27symlink(__DIR__, $softdirlinkname);
28include_once("$softdirlinkname" . '\\a.php');
29
30echo "Testing include_once using junction points\n";
31$junctionname = __DIR__ . '\\a_jdir';
32exec("mklink /J $junctionname " . __DIR__);
33include_once("$junctionname" . '\\a.php');
34
35unlink($filename);
36unlink($softlinkname);
37rmdir($softdirlinkname);
38rmdir($junctionname);
39?>
40--EXPECT--
41Testing include_once using file symbolic link
42I am included
43Testing include_once using directory symbolic link
44Testing include_once using junction points
45