summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/bug65701.phpt
blob: c4a356b41b7fade55863c3dac8d5405e1e75432c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
Test for bug #65701: copy() doesn't work when destination filename is created by tempnam()
--CREDITS--
Boro Sitnikovski <buritomath@yahoo.com>
--FILE--
<?php
$file_path = __DIR__ . "/bug65701/";

if (!is_dir($file_path)) {
	mkdir($file_path);
}

$src = $file_path . '/srcbug65701_file.txt';
$dst = tempnam($file_path, 'dstbug65701_file.txt');

file_put_contents($src, "Hello World");

copy($src, $dst);
var_dump(filesize($dst));
?>
--CLEAN--
<?php
$file_path = __DIR__ . "/bug65701/";
foreach (scandir($file_path) as $file) {
    if (strpos($file, "bug65701") !== false || 'WIN' == substr(PHP_OS, 0, 3)) {
        unlink($file_path . $file);
    }
}
rmdir($file_path);
?>
--EXPECT--
int(11)