1--TEST--
2Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243)
3--FILE--
4<?php
5/* Test copy(): Trying to copy dir to an existing file */
6
7echo "*** Test copy() function: Trying to copy dir to file ***\n";
8$file_path = __DIR__;
9$file = $file_path."/copy_variation13_dir.tmp";
10fclose(fopen($file, "w"));
11$dir = $file_path."/copy_variation13";
12mkdir($dir);
13
14echo "*** Testing copy() in copying dir to file ***\n";
15var_dump( copy($dir, $file) );
16
17var_dump( file_exists($file) );
18var_dump( file_exists($dir) );
19
20var_dump( is_file($dir) );
21var_dump( is_dir($dir) );
22
23var_dump( is_file($file) );
24var_dump( is_dir($file) );
25
26var_dump( filesize($file) );
27var_dump( filesize($dir) );
28
29echo "*** Done ***\n";
30?>
31--CLEAN--
32<?php
33unlink(__DIR__."/copy_variation13_dir.tmp");
34rmdir(__DIR__."/copy_variation13");
35?>
36--EXPECTF--
37*** Test copy() function: Trying to copy dir to file ***
38*** Testing copy() in copying dir to file ***
39
40Warning: copy(): The first argument to copy() function cannot be a directory in %scopy_variation13.php on line %d
41bool(false)
42bool(true)
43bool(true)
44bool(false)
45bool(true)
46bool(true)
47bool(false)
48int(%d)
49int(%d)
50*** Done ***
51