diff --git a/src/Composer/Command/BaseDependencyCommand.php b/src/Composer/Command/BaseDependencyCommand.php index ba48173da..78eeaea85 100644 --- a/src/Composer/Command/BaseDependencyCommand.php +++ b/src/Composer/Command/BaseDependencyCommand.php @@ -59,7 +59,7 @@ class BaseDependencyCommand extends BaseCommand $platformOverrides = $composer->getConfig()->get('platform') ?: array(); $installedRepo = new InstalledRepository(array( - new RootPackageRepository($composer->getPackage()), + new RootPackageRepository(clone $composer->getPackage()), $composer->getRepositoryManager()->getLocalRepository(), new PlatformRepository(array(), $platformOverrides), )); diff --git a/src/Composer/Command/CheckPlatformReqsCommand.php b/src/Composer/Command/CheckPlatformReqsCommand.php index 73aee9551..aa5b95e46 100644 --- a/src/Composer/Command/CheckPlatformReqsCommand.php +++ b/src/Composer/Command/CheckPlatformReqsCommand.php @@ -80,7 +80,7 @@ EOT $requires[$require] = array($link); } - $installedRepo = new InstalledRepository(array($installedRepo, new RootPackageRepository($composer->getPackage()))); + $installedRepo = new InstalledRepository(array($installedRepo, new RootPackageRepository(clone $composer->getPackage()))); foreach ($installedRepo->getPackages() as $package) { if (in_array($package->getName(), $removePackages, true)) { continue; diff --git a/src/Composer/Command/HomeCommand.php b/src/Composer/Command/HomeCommand.php index ad4a42713..775aa04b9 100644 --- a/src/Composer/Command/HomeCommand.php +++ b/src/Composer/Command/HomeCommand.php @@ -167,7 +167,7 @@ EOT if ($composer) { return array_merge( - array(new RootPackageRepository($composer->getPackage())), // root package + array(new RootPackageRepository(clone $composer->getPackage())), // root package array($composer->getRepositoryManager()->getLocalRepository()), // installed packages $composer->getRepositoryManager()->getRepositories() // remotes ); diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 6df57e08c..3e14bd834 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -167,7 +167,7 @@ EOT $lockedRepo = null; if ($input->getOption('self')) { - $package = $this->getComposer()->getPackage(); + $package = clone $this->getComposer()->getPackage(); if ($input->getOption('name-only')) { $io->write($package->getName());