@ -573,7 +583,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
protected function fetchFile($filename, $cacheKey = null, $sha256 = null)
protected function fetchFile($filename, $cacheKey = null, $sha256 = null)
{
{
if (!$cacheKey) {
if (null === $cacheKey) {
$cacheKey = $filename;
$cacheKey = $filename;
$filename = $this->baseUrl.'/'.$filename;
$filename = $this->baseUrl.'/'.$filename;
}
}
@ -597,7 +607,9 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This should indicate a man-in-the-middle attack. Try running composer again and report this if you think it is a mistake.');
throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This should indicate a man-in-the-middle attack. Try running composer again and report this if you think it is a mistake.');
}
}
$data = JsonFile::parseJson($json, $filename);
$data = JsonFile::parseJson($json, $filename);
if ($cacheKey) {
$this->cache->write($cacheKey, $json);
$this->cache->write($cacheKey, $json);
}
break;
break;
} catch (\Exception $e) {
} catch (\Exception $e) {
@ -610,7 +622,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
throw $e;
throw $e;
}
}
if ($contents = $this->cache->read($cacheKey)) {
if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
$this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
$this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');