Return to open_basedir_fopen.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security |
1.1 ! misho 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("fopen"); ! 10: ! 11: var_dump(fopen("../bad", "r")); ! 12: var_dump(fopen("../bad/bad.txt", "r")); ! 13: var_dump(fopen("..", "r")); ! 14: var_dump(fopen("../", "r")); ! 15: var_dump(fopen("/", "r")); ! 16: var_dump(fopen("../bad/.", "r")); ! 17: var_dump(fopen("../bad/./bad.txt", "r")); ! 18: var_dump(fopen("./../.", "r")); ! 19: ! 20: var_dump(fopen($initdir."/test/ok/ok.txt", "r")); ! 21: var_dump(fopen("./ok.txt", "r")); ! 22: var_dump(fopen("ok.txt", "r")); ! 23: var_dump(fopen("../ok/ok.txt", "r")); ! 24: var_dump(fopen("../ok/./ok.txt", "r")); ! 25: ! 26: test_open_basedir_after("fopen"); ! 27: ?> ! 28: --CLEAN-- ! 29: <?php ! 30: require_once "open_basedir.inc"; ! 31: delete_directories(); ! 32: ?> ! 33: --EXPECTF-- ! 34: *** Testing open_basedir configuration [fopen] *** ! 35: bool(true) ! 36: bool(true) ! 37: bool(true) ! 38: bool(true) ! 39: bool(true) ! 40: ! 41: Warning: fopen(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d ! 42: ! 43: Warning: fopen(../bad): failed to open stream: %s in %s on line %d ! 44: bool(false) ! 45: ! 46: Warning: fopen(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d ! 47: ! 48: Warning: fopen(../bad/bad.txt): failed to open stream: %s in %s on line %d ! 49: bool(false) ! 50: ! 51: Warning: fopen(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d ! 52: ! 53: Warning: fopen(..): failed to open stream: %s in %s on line %d ! 54: bool(false) ! 55: ! 56: Warning: fopen(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d ! 57: ! 58: Warning: fopen(../): failed to open stream: %s in %s on line %d ! 59: bool(false) ! 60: ! 61: Warning: fopen(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d ! 62: ! 63: Warning: fopen(/): failed to open stream: %s in %s on line %d ! 64: bool(false) ! 65: ! 66: Warning: fopen(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d ! 67: ! 68: Warning: fopen(../bad/.): failed to open stream: %s in %s on line %d ! 69: bool(false) ! 70: ! 71: Warning: fopen(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d ! 72: ! 73: Warning: fopen(../bad/./bad.txt): failed to open stream: %s in %s on line 12 ! 74: bool(false) ! 75: ! 76: Warning: fopen(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d ! 77: ! 78: Warning: fopen(./../.): failed to open stream: %s in %s on line %d ! 79: bool(false) ! 80: resource(%d) of type (stream) ! 81: resource(%d) of type (stream) ! 82: resource(%d) of type (stream) ! 83: resource(%d) of type (stream) ! 84: resource(%d) of type (stream) ! 85: *** Finished testing open_basedir configuration [fopen] *** ! 86: