xref: /PHP-8.2/ext/standard/tests/file/bug44805.phpt (revision f8d79582)
1--TEST--
2Bug#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
9file_put_contents($file1, "this is file 1");
10file_put_contents($file2, "this is file 2");
11
12rename($file1, $file2);
13
14echo "reading file 2: ";
15readfile($file2);
16if (file_exists($file1)) {
17    unlink($file1);
18}
19if (file_exists($file2)) {
20    unlink($file2);
21}
22?>
23--EXPECT--
24reading file 2: this is file 1
25