Selaa lähdekoodia

Make sure Phar overwrites files and doesn't load them

Nils Adermann 12 vuotta sitten
vanhempi
commit
8803281648
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      src/Composer/Package/Archiver/PharArchiver.php

+ 5 - 0
src/Composer/Package/Archiver/PharArchiver.php

@@ -34,6 +34,11 @@ class PharArchiver implements ArchiverInterface
     {
         $sources = realpath($sources);
 
+        // Phar would otherwise load the file which we don't want
+        if (file_exists($target)) {
+            unlink($target);
+        }
+
         try {
             $phar = new \PharData($target, null, null, static::$formats[$format]);
             $files = new ArchivableFilesFinder($sources, $excludes);