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