open_basedir_chmod.phpt 2.1 KB

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