1--TEST--
2Test open_basedir configuration
3--INI--
4open_basedir=.
5--FILE--
6<?php
7require_once "open_basedir.inc";
8$initdir = getcwd();
9test_open_basedir_before("touch");
10
11var_dump(touch("../bad"));
12var_dump(touch("../bad/bad.txt"));
13var_dump(touch(".."));
14var_dump(touch("../"));
15var_dump(touch("/"));
16var_dump(touch("../bad/."));
17var_dump(touch("../bad/./bad.txt"));
18var_dump(touch("./../."));
19
20var_dump(touch($initdir."/test/ok/ok.txt"));
21var_dump(touch("./ok.txt"));
22var_dump(touch("ok.txt"));
23var_dump(touch("../ok/ok.txt"));
24var_dump(touch("../ok/./ok.txt"));
25
26test_open_basedir_after("touch");
27?>
28--CLEAN--
29<?php
30require_once "open_basedir.inc";
31delete_directories();
32?>
33--EXPECTF--
34*** Testing open_basedir configuration [touch] ***
35bool(true)
36bool(true)
37bool(true)
38bool(true)
39bool(true)
40
41Warning: touch(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
42bool(false)
43
44Warning: touch(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
45bool(false)
46
47Warning: touch(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
48bool(false)
49
50Warning: touch(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
51bool(false)
52
53Warning: touch(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
54bool(false)
55
56Warning: touch(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
57bool(false)
58
59Warning: touch(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
60bool(false)
61
62Warning: touch(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
63bool(false)
64bool(true)
65bool(true)
66bool(true)
67bool(true)
68bool(true)
69*** Finished testing open_basedir configuration [touch] ***
70
71