From 104bf0d75d9b9b6b4d9c462d6f7061f41ec13cc8 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 16 Aug 2022 11:44:21 +0200 Subject: [PATCH] Handle 404s gracefully when loading providers in ComposerRepo, fixes #10974 --- src/Composer/Repository/ComposerRepository.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 640001cec..45accf11f 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -607,7 +607,14 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito $result = array(); if ($this->providersApiUrl) { - $apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson(); + try { + $apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson(); + } catch (TransportException $e) { + if ($e->getStatusCode() === 404) { + return $result; + } + throw $e; + } foreach ($apiResult['providers'] as $provider) { $result[$provider['name']] = $provider;