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