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("opendir");
10test_open_basedir_error("opendir");
11
12var_dump(opendir($initdir."/test/ok/"));
13var_dump(opendir($initdir."/test/ok"));
14var_dump(opendir($initdir."/test/ok/../ok"));
15
16test_open_basedir_after("opendir");?>
17--CLEAN--
18<?php
19require_once "open_basedir.inc";
20delete_directories();
21?>
22--EXPECTF--
23*** Testing open_basedir configuration [opendir] ***
24bool(true)
25bool(true)
26bool(true)
27bool(true)
28bool(true)
29
30Warning: opendir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
31
32Warning: opendir(../bad): failed to open dir: %s in %s on line %d
33bool(false)
34
35Warning: opendir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
36
37Warning: opendir(../bad/bad.txt): failed to open dir: %s in %s on line %d
38bool(false)
39
40Warning: opendir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
41
42Warning: opendir(..): failed to open dir: %s in %s on line %d
43bool(false)
44
45Warning: opendir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
46
47Warning: opendir(../): failed to open dir: %s in %s on line %d
48bool(false)
49
50Warning: opendir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
51
52Warning: opendir(/): failed to open dir: %s in %s on line %d
53bool(false)
54
55Warning: opendir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
56
57Warning: opendir(../bad/.): failed to open dir: %s in %s on line %d
58bool(false)
59
60Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
61
62Warning: opendir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
63bool(false)
64
65Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
66
67Warning: opendir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
68bool(false)
69resource(%d) of type (stream)
70resource(%d) of type (stream)
71resource(%d) of type (stream)
72*** Finished testing open_basedir configuration [opendir] ***
73
74