Annotation of embedaddon/php/tests/security/open_basedir_mkdir.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test open_basedir configuration
! 3: --SKIPIF--
! 4: <?php
! 5: if (substr(PHP_OS, 0, 3) != 'WIN') {
! 6: die('skip Windows only variation');
! 7: }
! 8: ?>
! 9: --INI--
! 10: open_basedir=.
! 11: --FILE--
! 12: <?php
! 13: require_once "open_basedir.inc";
! 14: $initdir = getcwd();
! 15: test_open_basedir_before("mkdir");
! 16:
! 17: var_dump(mkdir("../bad/blah"));
! 18: var_dump(mkdir("../blah"));
! 19: var_dump(mkdir("../bad/./blah"));
! 20: var_dump(mkdir("./.././blah"));
! 21:
! 22: var_dump(mkdir($initdir."/test/ok/blah"));
! 23: var_dump(rmdir($initdir."/test/ok/blah"));
! 24: test_open_basedir_after("mkdir");
! 25: ?>
! 26: --CLEAN--
! 27: <?php
! 28: require_once "open_basedir.inc";
! 29: delete_directories();
! 30: ?>
! 31: --EXPECTF--
! 32: *** Testing open_basedir configuration [mkdir] ***
! 33: bool(true)
! 34: bool(true)
! 35: bool(true)
! 36: bool(true)
! 37: bool(true)
! 38:
! 39: Warning: mkdir(): open_basedir restriction in effect. File(../bad/blah) is not within the allowed path(s): (.) in %s on line %d
! 40: bool(false)
! 41:
! 42: Warning: mkdir(): open_basedir restriction in effect. File(../blah) is not within the allowed path(s): (.) in %s on line %d
! 43: bool(false)
! 44:
! 45: Warning: mkdir(): open_basedir restriction in effect. File(../bad/./blah) is not within the allowed path(s): (.) in %s on line %d
! 46: bool(false)
! 47:
! 48: Warning: mkdir(): open_basedir restriction in effect. File(./.././blah) is not within the allowed path(s): (.) in %s on line %d
! 49: bool(false)
! 50: bool(true)
! 51: bool(true)
! 52: *** Finished testing open_basedir configuration [mkdir] ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>