diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 420bde535..43087ee7f 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -250,13 +250,18 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito foreach ($packageNameMap as $name => $constraint) { $matches = array(); + // if a repo has no providers but only partial packages and the partial packages are missing + // then we don't want to call whatProvides as it would try to load from the providers and fail if (!$hasProviders && !isset($this->partialPackagesByName[$name])) { continue; } $candidates = $this->whatProvides($name, $isPackageAcceptableCallable); foreach ($candidates as $candidate) { - if ($candidate->getName() === $name && (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion())))) { + if ($candidate->getName() !== $name) { + throw new \LogicException('whatProvides should never return a package with a different name than the requested one'); + } + if (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) { $matches[spl_object_hash($candidate)] = $candidate; if ($candidate instanceof AliasPackage && !isset($matches[spl_object_hash($candidate->getAliasOf())])) { $matches[spl_object_hash($candidate->getAliasOf())] = $candidate->getAliasOf(); @@ -278,7 +283,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito return $packages; } - if ($this->lazyProvidersUrl) { + if ($this->lazyProvidersUrl && count($packageNameMap)) { $packages = array_merge($packages, $this->loadAsyncPackages($packageNameMap, $isPackageAcceptableCallable)); } diff --git a/src/Composer/Util/Http/CurlDownloader.php b/src/Composer/Util/Http/CurlDownloader.php index 45b1d21de..3dc6710b6 100644 --- a/src/Composer/Util/Http/CurlDownloader.php +++ b/src/Composer/Util/Http/CurlDownloader.php @@ -225,6 +225,7 @@ class CurlDownloader if (!isset($this->jobs[$i])) { continue; } + $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo); $job = $this->jobs[$i]; unset($this->jobs[$i]); @@ -239,7 +240,7 @@ class CurlDownloader try { // TODO progress //$this->onProgress($curlHandle, $job['callback'], $progress, $job['progress']); - if (CURLE_OK !== $errno) { + if (CURLE_OK !== $errno || $error) { throw new TransportException($error); }