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