https://bugzilla.novell.com/show_bug.cgi?id=648509 https://bugzilla.novell.com/show_bug.cgi?id=648509#c0 Summary: PHP copy function fails when destination would overwrite a file Classification: openSUSE Product: openSUSE 11.2 Version: Final Platform: x86-64 OS/Version: openSUSE 11.2 Status: NEW Severity: Normal Priority: P5 - None Component: Other AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: reg@capiogroup.com QAContact: qa@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100914 SUSE/3.6.10-30.2 Firefox/3.6.10 I don't know if this should be reported here, or to the PHP developers. If this is the wrong place, please write back so I know to report it over there or let me know that you sent it "up the line"... if that's how it works. With the following PHP code: $src='/tmp/filehQMSWX' $dst='sites/mysite.com/files/js/gmap_markers.js' copy($src, $dst); The copy function fails. This is PHP5.3 running under Apache 2.2. My OS version is openSUSE 11.2. All available updates are installed as of this date. Knowing this I did the shell commands below to make sure the copy was legitimate and you can see the results: # sudo -u wwwrun cp /tmp/filehQMSWX sites/mysite.com/files/js/gmap_markers.js cp: cannot create regular file `sites/mysite.com/files/js/gmap_markers.js': Operation not permitted (above failed) # sudo -u wwwrun cp -f /tmp/filehQMSWX sites/mysite.com/files/js/gmap_markers.js (above worked) Clearly, the copy is possible with the user wwwrun. I also added file_exists($src), and file_exists($dst) just above the copy command and sure enough it only fails when the destination exists, however it should just overwrite as far as I can see. At least according to the documentation here: http://us2.php.net/manual/en/function.copy.php. As one last test I changed the copy command to: copy($src, real_path($dst)); just in case it was taking the relative dest. path as a URL, it still fails. Reproducible: Always Steps to Reproduce: 1.See above 2. 3. Actual Results: copy fails Expected Results: copy should overwrite file. The destination directory is a subdirectory of a drupal "files" directory. This means the permissions are 777. However, the owner, for my own purposes is web:web not wwwrun:www. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.