open_basedir_chdir.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test open_basedir configuration
  3. --INI--
  4. open_basedir=.
  5. --FILE--
  6. <?php
  7. require_once "open_basedir.inc";
  8. test_open_basedir_before("chdir");
  9. var_dump(chdir("../bad"));
  10. var_dump(chdir(".."));
  11. var_dump(chdir("../"));
  12. var_dump(chdir("/"));
  13. var_dump(chdir("../bad/."));
  14. var_dump(chdir("./../."));
  15. test_open_basedir_after("chdir");
  16. ?>
  17. --CLEAN--
  18. <?php
  19. require_once "open_basedir.inc";
  20. delete_directories();
  21. ?>
  22. --EXPECTF--
  23. *** Testing open_basedir configuration [chdir] ***
  24. bool(true)
  25. bool(true)
  26. bool(true)
  27. bool(true)
  28. bool(true)
  29. Warning: chdir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
  30. bool(false)
  31. Warning: chdir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
  32. bool(false)
  33. Warning: chdir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
  34. bool(false)
  35. Warning: chdir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
  36. bool(false)
  37. Warning: chdir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
  38. bool(false)
  39. Warning: chdir(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
  40. bool(false)
  41. *** Finished testing open_basedir configuration [chdir] ***