diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index ece870133..64a16a867 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -430,16 +430,18 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository break; } catch (\Exception $e) { - if ($contents = $this->cache->read($cacheKey)) { - if (!$this->degradedMode) { - $this->io->write(''.$e->getMessage().''); - $this->io->write(''.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date'); - } - $this->degradedMode = true; - $data = json_decode($contents, true); + if (!$retries) { + if ($contents = $this->cache->read($cacheKey)) { + if (!$this->degradedMode) { + $this->io->write(''.$e->getMessage().''); + $this->io->write(''.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date'); + } + $this->degradedMode = true; + $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey); + + break; + } - break; - } elseif (!$retries) { throw $e; }