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