From 261d93aacf80d7e28cb22b1b096c94e51baf0d37 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 19 Oct 2021 12:14:12 +0100 Subject: [PATCH] ComposerRepository: handle packages.json with null value for package (#10189) --- src/Composer/Repository/ComposerRepository.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 3310da516..d28c9b787 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -1038,8 +1038,10 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito // legacy repo handling if (!isset($data['packages']) && !isset($data['includes'])) { foreach ($data as $pkg) { - foreach ($pkg['versions'] as $metadata) { - $packages[] = $metadata; + if (isset($pkg['versions']) && is_array($pkg['versions'])) { + foreach ($pkg['versions'] as $metadata) { + $packages[] = $metadata; + } } }