From 8756f54da09cbdcade84ed1c6c7e7a4a7e81686f Mon Sep 17 00:00:00 2001 From: "Marko H. Tamminen" Date: Wed, 16 Feb 2022 13:17:49 +0200 Subject: [PATCH] Handle missing license when showing license summary (#10537) Fixes the issue of license summary command aborting when a package is missing license information. --- src/Composer/Command/LicensesCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/LicensesCommand.php b/src/Composer/Command/LicensesCommand.php index 5375ab08d..a8aadd021 100644 --- a/src/Composer/Command/LicensesCommand.php +++ b/src/Composer/Command/LicensesCommand.php @@ -125,7 +125,8 @@ EOT $usedLicenses = array(); foreach ($packages as $package) { $license = $package instanceof CompletePackageInterface ? $package->getLicense() : array(); - $licenseName = $license[0]; + $licenseName = array_key_exists(0, $license) ? $license[0] : 'none'; + if (!isset($usedLicenses[$licenseName])) { $usedLicenses[$licenseName] = 0; }