open_basedir_mkdir.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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("mkdir");
  10. var_dump(mkdir("../bad/blah"));
  11. var_dump(mkdir("../blah"));
  12. var_dump(mkdir("../bad/./blah"));
  13. var_dump(mkdir("./.././blah"));
  14. var_dump(mkdir($initdir."/test/ok/blah"));
  15. var_dump(rmdir($initdir."/test/ok/blah"));
  16. test_open_basedir_after("mkdir");
  17. ?>
  18. --CLEAN--
  19. <?php
  20. require_once "open_basedir.inc";
  21. delete_directories();
  22. ?>
  23. --EXPECTF--
  24. *** Testing open_basedir configuration [mkdir] ***
  25. bool(true)
  26. bool(true)
  27. bool(true)
  28. bool(true)
  29. bool(true)
  30. Warning: mkdir(): open_basedir restriction in effect. File(../bad/blah) is not within the allowed path(s): (.) in %s on line %d
  31. bool(false)
  32. Warning: mkdir(): open_basedir restriction in effect. File(../blah) is not within the allowed path(s): (.) in %s on line %d
  33. bool(false)
  34. Warning: mkdir(): open_basedir restriction in effect. File(../bad/./blah) is not within the allowed path(s): (.) in %s on line %d
  35. bool(false)
  36. Warning: mkdir(): open_basedir restriction in effect. File(./.././blah) is not within the allowed path(s): (.) in %s on line %d
  37. bool(false)
  38. bool(true)
  39. bool(true)
  40. *** Finished testing open_basedir configuration [mkdir] ***