bug44805.phpt 613 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug#44806 (rename() function is not portable to Windows)
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die('skip.. only for Windows');
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. $dirname = dirname(__FILE__);
  12. $file1 = $dirname . DIRECTORY_SEPARATOR . "file1.txt";
  13. $file2 = $dirname . DIRECTORY_SEPARATOR . "file2.txt";
  14. file_put_contents($file1, "this is file 1");
  15. file_put_contents($file2, "this is file 2");
  16. rename($file1, $file2);
  17. echo "reading file 2: ";
  18. readfile($file2);
  19. if (file_exists($file1)) {
  20. unlink($file1);
  21. }
  22. if (file_exists($file2)) {
  23. unlink($file2);
  24. }
  25. ?>
  26. --EXPECT--
  27. reading file 2: this is file 1