From 74e02193a84d84bc2617492d59e8f23448bffc23 Mon Sep 17 00:00:00 2001 From: Simon Berger Date: Fri, 11 Sep 2020 21:35:20 +0200 Subject: [PATCH] Do not hard fail on lazy repository when network is disabled and no package cache exists --- src/Composer/Repository/ComposerRepository.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index e0709f81c..675c55626 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -584,8 +584,11 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck); } catch (TransportException $e) { // 404s are acceptable for lazy provider repos - if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) { + if ($this->lazyProvidersUrl && in_array($e->getStatusCode(), array(404, 499), true)) { $packages = array('packages' => array()); + if ($e->getStatusCode() === 499) { + $this->io->error('' . $e->getMessage() . ''); + } } else { throw $e; }