bug44805.phpt 514 B

123456789101112131415161718192021222324
  1. --TEST--
  2. Bug#44806 (rename() function is not portable to Windows)
  3. --FILE--
  4. <?php
  5. $dirname = __DIR__;
  6. $file1 = $dirname . DIRECTORY_SEPARATOR . "file1.txt";
  7. $file2 = $dirname . DIRECTORY_SEPARATOR . "file2.txt";
  8. file_put_contents($file1, "this is file 1");
  9. file_put_contents($file2, "this is file 2");
  10. rename($file1, $file2);
  11. echo "reading file 2: ";
  12. readfile($file2);
  13. if (file_exists($file1)) {
  14. unlink($file1);
  15. }
  16. if (file_exists($file2)) {
  17. unlink($file2);
  18. }
  19. ?>
  20. --EXPECT--
  21. reading file 2: this is file 1