Explorar el Código

Make sure Phar overwrites files and doesn't load them

Nils Adermann hace 12 años
padre
commit
8803281648
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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);