006_basic.phpt 783 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Test fileperms() & chmod() functions: basic functionality
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) == 'WIN') {
  6. die('skip Not on Windows');
  7. }
  8. require __DIR__ . '/../skipif_root.inc';
  9. ?>
  10. --FILE--
  11. <?php
  12. $path = __DIR__;
  13. echo "*** Testing fileperms(), chmod() with files and dirs ***\n";
  14. fopen($path."/perm.tmp", "w");
  15. var_dump( chmod($path."/perm.tmp", 0755 ) );
  16. printf("%o", fileperms($path."/perm.tmp") );
  17. echo "\n";
  18. clearstatcache();
  19. mkdir($path."/perm");
  20. var_dump( chmod( $path."/perm", 0777 ) );
  21. printf("%o", fileperms($path."/perm") );
  22. echo "\n";
  23. clearstatcache();
  24. echo "Done\n";
  25. ?>
  26. --CLEAN--
  27. <?php
  28. unlink(__DIR__."/perm.tmp");
  29. rmdir(__DIR__."/perm");
  30. ?>
  31. --EXPECT--
  32. *** Testing fileperms(), chmod() with files and dirs ***
  33. bool(true)
  34. 100755
  35. bool(true)
  36. 40777
  37. Done