ID: 22951 User updated by: talk_to_me at unforgiver dot net Reported By: talk_to_me at unforgiver dot net Status: Open Bug Type: *Directory/Filesystem functions Operating System: Windows XP PHP Version: 4.3.1 New Comment:
http://www.php.net/manual/pl/function.copy.php " jay dot haslup at jhuapl dot edu 03-Mar-2003 09:52 Im using windows2000 with apache and php4.3.0. I have noticed that copying a zero size file does actually work but PHP thinks it didn't. if(copy("d:/dirsrc/file.txt", "d:/dirdest/file.txt")) { //The copy works but does not end up here... echo "Copy worked"; }else{ //...It ends up here echo "file.txt is in dirdest but ended up here"; } " You know that ? When you will fix it ? Previous Comments: ------------------------------------------------------------------------ [2003-03-29 13:31:21] talk_to_me at unforgiver dot net OK While testing my script I see this is a bug :) But only when filesize is 0B. Why I think this is a bug ? Because: if (@copy($some_path.$elemets[$i],$some_path2.$elemets[$i])) { echo 'File was copied.'; } else { echo 'File not copied.'; } target file is created (what means the file was copied) but $copied return false. ------------------------------------------------------------------------ [2003-03-29 09:21:17] talk_to_me at unforgiver dot net Windows XP without service pack 1. ------------------------------------------------------------------------ [2003-03-29 09:15:23] talk_to_me at unforgiver dot net When I'm trying to copy few files: $elmenets = array(); $elements[0] = 'some_file_1'; $elements[1] = 'some_file_2'; $elements[2] = 'some_file_3'; $elements[3] = 'some_file_4'; $elements[4] = 'some_file_5'; for ($i=0; $i<count($elements); $i++) { $copied = @copy($some_path.$elemets[$i],$some_path2.$elemets[$i]); } files are always copied but $copied sometime return true, sometime return false. Same thing is when try to unlink files with the same method. When remove '@' there is no error. Permissions for directories are OK. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22951&edit=1