From 2feeb5647702ac7a5d68a93515c995227e9a99c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=BClke?= Date: Fri, 21 Jul 2023 11:28:36 +0200 Subject: [PATCH] Fix 'composer show --platform ' erroring if no composer.json is present (#11533) Sort of related to #11046 (although this is not a regression, but didn't work before, either) --- src/Composer/Command/ShowCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 3e14bd834..c7e331646 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -699,7 +699,7 @@ EOT $io->write('homepage : ' . $package->getHomepage()); $io->write('source : ' . sprintf('[%s] %s %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference())); $io->write('dist : ' . sprintf('[%s] %s %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference())); - if ($installedRepo->hasPackage($package)) { + if (!PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package)) { $io->write('path : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package)))); } $io->write('names : ' . implode(', ', $package->getNames())); @@ -864,7 +864,7 @@ EOT ); } - if ($installedRepo->hasPackage($package)) { + if (!PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package)) { $json['path'] = realpath($this->getComposer()->getInstallationManager()->getInstallPath($package)); if ($json['path'] === false) { unset($json['path']);