Annotation of embedaddon/php/tests/security/open_basedir_link.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test open_basedir configuration
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) == 'WIN') {
6: die('skip no links 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("link");
16:
17: $target = ($initdir."/test/ok/ok.txt");
18: var_dump(link($target, "../bad/link.txt"));
19: var_dump(link($target, "../link.txt"));
20: var_dump(link($target, "../bad/./link.txt"));
21: var_dump(link($target, "./.././link.txt"));
22:
23: $link = ($initdir."/test/ok/link.txt");
24: var_dump(link("../bad/bad.txt", $link));
25: var_dump(link("../bad", $link));
26: var_dump(link("../bad/./bad.txt", $link));
27: var_dump(link("../bad/bad.txt", $link));
28: var_dump(link("./.././bad", $link));
29:
30: $target = ($initdir."/test/ok/ok.txt");
31:
32: var_dump(link($target, $link));
33: var_dump(unlink($link));
34: test_open_basedir_after("link");
35: ?>
36: --CLEAN--
37: <?php
38: require_once "open_basedir.inc";
39: delete_directories();
40: ?>
41: --EXPECTF--
42: *** Testing open_basedir configuration [link] ***
43: bool(true)
44: bool(true)
45: bool(true)
46: bool(true)
47: bool(true)
48:
49: Warning: link(): open_basedir restriction in effect. File(%s/test/bad/link.txt) is not within the allowed path(s): (.) in %s on line %d
50: bool(false)
51:
52: Warning: link(): open_basedir restriction in effect. File(%s/test/link.txt) is not within the allowed path(s): (.) in %s on line %d
53: bool(false)
54:
55: Warning: link(): open_basedir restriction in effect. File(%s/test/bad/link.txt) is not within the allowed path(s): (.) in %s on line %d
56: bool(false)
57:
58: Warning: link(): open_basedir restriction in effect. File(%s/test/link.txt) is not within the allowed path(s): (.) in %s on line %d
59: bool(false)
60:
61: Warning: link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
62: bool(false)
63:
64: Warning: link(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
65: bool(false)
66:
67: Warning: link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
68: bool(false)
69:
70: Warning: link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
71: bool(false)
72:
73: Warning: link(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
74: bool(false)
75: bool(true)
76: bool(true)
77: *** Finished testing open_basedir configuration [link] ***
78:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>