From 544067ced9d21c5286c1ce4ce2196450073522fb Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 25 Sep 2011 23:43:21 +0200 Subject: [PATCH] Packages can't be added to two repos at once --- src/Composer/Installer/LibraryInstaller.php | 2 +- src/Composer/Package/BasePackage.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 338c15910..251dac945 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -81,7 +81,7 @@ class LibraryInstaller implements InstallerInterface $downloadPath = $this->directory.DIRECTORY_SEPARATOR.$package->getName(); $this->downloadManager->download($package, $downloadPath); - $this->repository->addPackage($package); + $this->repository->addPackage(clone $package); } /** diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index 1caaf3ba8..526e9e0ac 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -153,4 +153,9 @@ abstract class BasePackage implements PackageInterface { return $this->getUniqueName(); } + + public function __clone() + { + $this->repository = null; + } }