xref: /PHP-5.6/ext/standard/tests/file/bug65701.phpt (revision 4638ba9c)
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 = dirname(__FILE__) . "/bug65701/";
8
9@mkdir($file_path);
10
11$src = $file_path . '/srcbug65701_file.txt';
12$dst = tempnam($file_path, 'dstbug65701_file.txt');
13
14file_put_contents($src, "Hello World");
15
16copy($src, $dst);
17var_dump(filesize($dst));
18?>
19--CLEAN--
20<?php
21$file_path = dirname(__FILE__) . "/bug65701/";
22foreach (scandir($file_path) as $file) {
23    if (strpos($file, "bug65701") !== false || 'WIN' == substr(PHP_OS, 0, 3)) {
24        unlink($file_path . $file);
25    }
26}
27rmdir($file_path);
28?>
29--EXPECT--
30int(11)
31