1
0
Fork 0

Fix composer show -a usage, fixes #9304

pull/9310/head
Jordi Boggiano 2020-10-20 17:34:07 +02:00
parent 99a5469b5e
commit 14ec957e96
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 9 additions and 1 deletions

View File

@ -584,7 +584,11 @@ EOT
$matchedPackage = null; $matchedPackage = null;
$versions = array(); $versions = array();
if (PlatformRepository::isPlatformPackage($name)) {
$pool = $repositorySet->createPoolWithAllPackages(); $pool = $repositorySet->createPoolWithAllPackages();
} else {
$pool = $repositorySet->createPoolForPackage($name);
}
$matches = $pool->whatProvides($name, $constraint); $matches = $pool->whatProvides($name, $constraint);
foreach ($matches as $index => $package) { foreach ($matches as $index => $package) {
// select an exact match if it is in the installed repo and no specific version was required // select an exact match if it is in the installed repo and no specific version was required

View File

@ -280,6 +280,10 @@ class RepositorySet
$request = new Request($lockedRepo); $request = new Request($lockedRepo);
foreach ($packageNames as $packageName) { foreach ($packageNames as $packageName) {
if (PlatformRepository::isPlatformPackage($packageName)) {
throw new \LogicException('createPoolForPackage(s) can not be used for platform packages, as they are never loaded by the PoolBuilder which expects them to be fixed. Use createPoolWithAllPackages or pass in a proper request with the platform packages you need fixed in it.');
}
$request->requireName($packageName); $request->requireName($packageName);
} }