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