I currently oversee the licenses used in our projects It would make sense to update the file as suggested in order to comply with the license identifiers as listed by SPDX http://spdx.org/licenses/ Reasoning: "Apache" could imply any version of the license, whereby only version 2 is compatible with the GPL v3. For details e.g. see http://www.gnu.org/licenses/license-list.html#GPLIncompatibleLicenses
Though it's not necessarily wrong to first clear to location to where to file is copied to, it's not needed. Because copy() will overwrite just as well as rename() will. Also cleaning up the original file after is a good idea, it will then mimic rename(). This was the intention with for this patch all along.
Under, unfortunately unknown, circumstances rename() does not work properly under windows when the target file exists. See also this comment http://us2.php.net/manual/en/function.rename.php#60341 When testing and removing the @ in front of rename() the following occured: PHP Warning: rename(C:\inetpub\symfony\app\cache\prod\jms_diextra\metadata\met666B.tmp,C:/inetpub/symfony/app/cache/prod/jms_diextra/metadata/.cache.php): Access is denied. (code: 5) in C:\inetpub\symfony\vendor\jms\metadata\src\Metadata\Cache\FileCache.php on line 98 This is a patch to fix the problem for the windows platform. Like the comment describes the function will no longer be atomic (rename vs unlink+copy). But it seems to be the best solution available. Sometimes it happens, sometimes it doesn't, i'm afraid i can't pinpoint the exact cause without diving into PHP internals and C. The problem was found investigating this issue #39