open_basedir_opendir.phpt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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("opendir");
  10. test_open_basedir_error("opendir");
  11. var_dump(opendir($initdir."/test/ok/"));
  12. var_dump(opendir($initdir."/test/ok"));
  13. var_dump(opendir($initdir."/test/ok/../ok"));
  14. test_open_basedir_after("opendir");?>
  15. --CLEAN--
  16. <?php
  17. require_once "open_basedir.inc";
  18. delete_directories();
  19. ?>
  20. --EXPECTF--
  21. *** Testing open_basedir configuration [opendir] ***
  22. bool(true)
  23. bool(true)
  24. bool(true)
  25. bool(true)
  26. bool(true)
  27. Warning: opendir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
  28. Warning: opendir(../bad): Failed to open directory: %s in %s on line %d
  29. bool(false)
  30. Warning: opendir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
  31. Warning: opendir(../bad/bad.txt): Failed to open directory: %s in %s on line %d
  32. bool(false)
  33. Warning: opendir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
  34. Warning: opendir(..): Failed to open directory: %s in %s on line %d
  35. bool(false)
  36. Warning: opendir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
  37. Warning: opendir(../): Failed to open directory: %s in %s on line %d
  38. bool(false)
  39. Warning: opendir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
  40. Warning: opendir(/): Failed to open directory: %s in %s on line %d
  41. bool(false)
  42. Warning: opendir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
  43. Warning: opendir(../bad/.): Failed to open directory: %s in %s on line %d
  44. bool(false)
  45. Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
  46. Warning: opendir(%s/test/bad/bad.txt): Failed to open directory: %s in %s on line %d
  47. bool(false)
  48. Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
  49. Warning: opendir(%s/test/bad/../bad/bad.txt): Failed to open directory: %s in %s on line %d
  50. bool(false)
  51. resource(%d) of type (stream)
  52. resource(%d) of type (stream)
  53. resource(%d) of type (stream)
  54. *** Finished testing open_basedir configuration [opendir] ***