xref: /PHP-7.4/ext/standard/tests/file/bug65701.phpt (revision 26dfce7f)
1--TEST--
2Test for bug #65701: copy() doesn't work when destination filename is created by tempnam()
3--CREDITS--
4Boro Sitnikovski <buritomath@yahoo.com>
5--FILE--
6<?php
7$file_path = __DIR__ . "/bug65701/";
8
9if (!is_dir($file_path)) {
10	mkdir($file_path);
11}
12
13$src = $file_path . '/srcbug65701_file.txt';
14$dst = tempnam($file_path, 'dstbug65701_file.txt');
15
16file_put_contents($src, "Hello World");
17
18copy($src, $dst);
19var_dump(filesize($dst));
20?>
21--CLEAN--
22<?php
23$file_path = __DIR__ . "/bug65701/";
24foreach (scandir($file_path) as $file) {
25    if (strpos($file, "bug65701") !== false || 'WIN' == substr(PHP_OS, 0, 3)) {
26        unlink($file_path . $file);
27    }
28}
29rmdir($file_path);
30?>
31--EXPECT--
32int(11)
33