File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
security /
open_basedir_file_put_contents.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
1: --TEST--
2: Test open_basedir configuration
3: --INI--
4: open_basedir=.
5: --FILE--
6: <?php
7: require_once "open_basedir.inc";
8: $initdir = getcwd();
9: test_open_basedir_before("file_put_contents");
10:
11: var_dump(file_put_contents("../bad/bad.txt", "Hello World!"));
12: var_dump(file_put_contents(".././bad/bad.txt", "Hello World!"));
13: var_dump(file_put_contents("../bad/../bad/bad.txt", "Hello World!"));
14: var_dump(file_put_contents("./.././bad/bad.txt", "Hello World!"));
15: var_dump(file_put_contents($initdir."/test/bad/bad.txt", "Hello World!"));
16:
17: test_open_basedir_after("file_put_contents");
18: ?>
19: --CLEAN--
20: <?php
21: require_once "open_basedir.inc";
22: delete_directories();
23: ?>
24: --EXPECTF--
25: *** Testing open_basedir configuration [file_put_contents] ***
26: bool(true)
27: bool(true)
28: bool(true)
29: bool(true)
30: bool(true)
31:
32: Warning: file_put_contents(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
33:
34: Warning: file_put_contents(../bad/bad.txt): failed to open stream: %s in %s on line %d
35: bool(false)
36:
37: Warning: file_put_contents(): open_basedir restriction in effect. File(.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
38:
39: Warning: file_put_contents(.././bad/bad.txt): failed to open stream: %s in %s on line %d
40: bool(false)
41:
42: Warning: file_put_contents(): open_basedir restriction in effect. File(../bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
43:
44: Warning: file_put_contents(../bad/../bad/bad.txt): failed to open stream: %s in %s on line %d
45: bool(false)
46:
47: Warning: file_put_contents(): open_basedir restriction in effect. File(./.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
48:
49: Warning: file_put_contents(./.././bad/bad.txt): failed to open stream: %s in %s on line %d
50: bool(false)
51:
52: Warning: file_put_contents(): open_basedir restriction in effect. File%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
53:
54: Warning: file_put_contents%s/test/bad/bad.txt): failed to open stream: %s in %s on line %d
55: bool(false)
56: *** Finished testing open_basedir configuration [file_put_contents] ***
57:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>