1
0
Fork 0

Always clone root package before adding it to a RootPackageRepo to avoid issues with plugins, fixes #10940

pull/10985/head
Jordi Boggiano 2022-07-13 15:10:15 +02:00
parent 336a0d20c6
commit b195f383f2
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ class BaseDependencyCommand extends BaseCommand
$platformOverrides = $composer->getConfig()->get('platform') ?: array(); $platformOverrides = $composer->getConfig()->get('platform') ?: array();
$installedRepo = new InstalledRepository(array( $installedRepo = new InstalledRepository(array(
new RootPackageRepository($composer->getPackage()), new RootPackageRepository(clone $composer->getPackage()),
$composer->getRepositoryManager()->getLocalRepository(), $composer->getRepositoryManager()->getLocalRepository(),
new PlatformRepository(array(), $platformOverrides), new PlatformRepository(array(), $platformOverrides),
)); ));

View File

@ -80,7 +80,7 @@ EOT
$requires[$require] = array($link); $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) { foreach ($installedRepo->getPackages() as $package) {
if (in_array($package->getName(), $removePackages, true)) { if (in_array($package->getName(), $removePackages, true)) {
continue; continue;

View File

@ -167,7 +167,7 @@ EOT
if ($composer) { if ($composer) {
return array_merge( return array_merge(
array(new RootPackageRepository($composer->getPackage())), // root package array(new RootPackageRepository(clone $composer->getPackage())), // root package
array($composer->getRepositoryManager()->getLocalRepository()), // installed packages array($composer->getRepositoryManager()->getLocalRepository()), // installed packages
$composer->getRepositoryManager()->getRepositories() // remotes $composer->getRepositoryManager()->getRepositories() // remotes
); );

View File

@ -167,7 +167,7 @@ EOT
$lockedRepo = null; $lockedRepo = null;
if ($input->getOption('self')) { if ($input->getOption('self')) {
$package = $this->getComposer()->getPackage(); $package = clone $this->getComposer()->getPackage();
if ($input->getOption('name-only')) { if ($input->getOption('name-only')) {
$io->write($package->getName()); $io->write($package->getName());