--TEST-- Test copy() function: usage variations - destination file names(empty string, nulls & bools) --SKIPIF-- --FILE-- "; var_dump( filesize($src_file_name) ); clearstatcache(); echo "\n-- Now applying copy() on source file to create copies --"; $count = 1; foreach($dest_files as $dest_file) { echo "\n-- Iteration $count --\n"; $dest_file_name = $file_path."/$dest_file"; echo "Existence of destination file before copy => "; var_dump( file_exists($dest_file_name) ); echo "Copy operation => "; var_dump( copy($src_file_name, $dest_file_name) ); echo "Existence of destination file => "; var_dump( file_exists($dest_file_name) ); if( file_exists($dest_file_name) ) { echo "Destination file name => "; print($dest_file_name); echo "\n"; echo "Size of source file => "; var_dump( filesize($src_file_name) ); clearstatcache(); echo "Size of destination file => "; var_dump( filesize($dest_file_name) ); clearstatcache(); unlink($dest_file_name); } $count++; } echo "*** Done ***\n"; ?> --CLEAN-- --EXPECTF-- *** Test copy() function: destination file names with empty string, nulls & bools *** Size of the source file before copy operation => int(1500) -- Now applying copy() on source file to create copies -- -- Iteration 1 -- Existence of destination file before copy => bool(true) Copy operation => Warning: copy(%s): %s bool(false) Existence of destination file => bool(true) Destination file name => %s/ Size of source file => int(1500) Size of destination file => int(0) Warning: unlink(%s): %s -- Iteration 2 -- Existence of destination file before copy => bool(true) Copy operation => Warning: copy(%s): %s bool(false) Existence of destination file => bool(true) Destination file name => %s/ Size of source file => int(1500) Size of destination file => int(0) Warning: unlink(%s): %s -- Iteration 3 -- Existence of destination file before copy => bool(true) Copy operation => Warning: copy(%s): %s bool(false) Existence of destination file => bool(true) Destination file name => %s/ Size of source file => int(1500) Size of destination file => int(0) Warning: unlink(%s): %s -- Iteration 4 -- Existence of destination file before copy => bool(true) Copy operation => Warning: copy(%s): %s bool(false) Existence of destination file => bool(true) Destination file name => %s/ Size of source file => int(1500) Size of destination file => int(0) Warning: unlink(%s): %s -- Iteration 5 -- Existence of destination file before copy => bool(true) Copy operation => Warning: copy(%s): %s bool(false) Existence of destination file => bool(true) Destination file name => %s/ Size of source file => int(1500) Size of destination file => int(0) Warning: unlink(%s): %s -- Iteration 6 -- Existence of destination file before copy => bool(false) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name => %s/1 Size of source file => int(1500) Size of destination file => int(1500) -- Iteration 7 -- Existence of destination file before copy => bool(false) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name => %s/1 Size of source file => int(1500) Size of destination file => int(1500) *** Done ***