1: --TEST--
2: Test open_basedir configuration
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) == 'WIN') {
6: die('skip no symlinks on Windows');
7: }
8: ?>
9: --INI--
10: open_basedir=.
11: --FILE--
12: <?php
13: require_once "open_basedir.inc";
14: $initdir = getcwd();
15: test_open_basedir_before("linkinfo", FALSE);
16:
17: chdir($initdir);
18:
19: $target = ($initdir."/test/bad/bad.txt");
20: $symlink = ($initdir."/test/ok/symlink.txt");
21: var_dump(symlink($target, $symlink));
22:
23: chdir($initdir."/test/ok");
24:
25: var_dump(linkinfo("symlink.txt"));
26: var_dump(linkinfo("../ok/symlink.txt"));
27: var_dump(linkinfo("../ok/./symlink.txt"));
28: var_dump(linkinfo("./symlink.txt"));
29: var_dump(linkinfo($initdir."/test/ok/symlink.txt"));
30:
31: $target = ($initdir."/test/ok/ok.txt");
32: $symlink = ($initdir."/test/ok/symlink.txt");
33: var_dump(symlink($target, $symlink));
34: var_dump(linkinfo($symlink));
35: var_dump(unlink($symlink));
36:
37: test_open_basedir_after("linkinfo");
38: ?>
39: --CLEAN--
40: <?php
41: require_once "open_basedir.inc";
42: delete_directories();
43: ?>
44: --EXPECTF--
45: *** Testing open_basedir configuration [linkinfo] ***
46: bool(true)
47: bool(true)
48: bool(true)
49: bool(true)
50: bool(true)
51: int(%d)
52: int(%d)
53: int(%d)
54: int(%d)
55: int(%d)
56:
57: Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
58: bool(false)
59: int(%d)
60:
61: Warning: unlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
62: bool(false)
63: *** Finished testing open_basedir configuration [linkinfo] ***
64:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>