open_basedir_mkdir.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Test open_basedir configuration
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die('skip Windows only variation');
  7. }
  8. ?>
  9. --INI--
  10. open_basedir=.
  11. --FILE--
  12. <?php
  13. require_once "open_basedir.inc";
  14. $initdir = getcwd();
  15. test_open_basedir_before("mkdir");
  16. var_dump(mkdir("../bad/blah"));
  17. var_dump(mkdir("../blah"));
  18. var_dump(mkdir("../bad/./blah"));
  19. var_dump(mkdir("./.././blah"));
  20. var_dump(mkdir($initdir."/test/ok/blah"));
  21. var_dump(rmdir($initdir."/test/ok/blah"));
  22. test_open_basedir_after("mkdir");
  23. ?>
  24. --CLEAN--
  25. <?php
  26. require_once "open_basedir.inc";
  27. delete_directories();
  28. ?>
  29. --EXPECTF--
  30. *** Testing open_basedir configuration [mkdir] ***
  31. bool(true)
  32. bool(true)
  33. bool(true)
  34. bool(true)
  35. bool(true)
  36. Warning: mkdir(): open_basedir restriction in effect. File(../bad/blah) is not within the allowed path(s): (.) in %s on line %d
  37. bool(false)
  38. Warning: mkdir(): open_basedir restriction in effect. File(../blah) is not within the allowed path(s): (.) in %s on line %d
  39. bool(false)
  40. Warning: mkdir(): open_basedir restriction in effect. File(../bad/./blah) is not within the allowed path(s): (.) in %s on line %d
  41. bool(false)
  42. Warning: mkdir(): open_basedir restriction in effect. File(./.././blah) is not within the allowed path(s): (.) in %s on line %d
  43. bool(false)
  44. bool(true)
  45. bool(true)
  46. *** Finished testing open_basedir configuration [mkdir] ***