Fix 5.3/undef var issues
parent
2901995fc8
commit
46e35bc8d7
|
@ -34,6 +34,7 @@ use Composer\Semver\Constraint\Constraint;
|
||||||
use Composer\Semver\Constraint\EmptyConstraint;
|
use Composer\Semver\Constraint\EmptyConstraint;
|
||||||
use Composer\Util\Http\Response;
|
use Composer\Util\Http\Response;
|
||||||
use Composer\Util\MetadataMinifier;
|
use Composer\Util\MetadataMinifier;
|
||||||
|
use React\Promise\Util as PromiseUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
@ -67,10 +68,12 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
private $partialPackagesByName;
|
private $partialPackagesByName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO v3 should make this private once we can drop PHP 5.3 support
|
||||||
|
* @private
|
||||||
* @var array list of package names which returned a 404 and should not be re-fetched in case loadPackage is called several times
|
* @var array list of package names which returned a 404 and should not be re-fetched in case loadPackage is called several times
|
||||||
* useful for v2 metadata repositories with lazy providers
|
* useful for v2 metadata repositories with lazy providers
|
||||||
*/
|
*/
|
||||||
private $packagesNotFoundCache = array();
|
public $packagesNotFoundCache = array();
|
||||||
/**
|
/**
|
||||||
* TODO v3 should make this private once we can drop PHP 5.3 support
|
* TODO v3 should make this private once we can drop PHP 5.3 support
|
||||||
* @private
|
* @private
|
||||||
|
@ -1086,7 +1089,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
$retries = 3;
|
$retries = 3;
|
||||||
|
|
||||||
if (isset($this->packagesNotFoundCache[$filename])) {
|
if (isset($this->packagesNotFoundCache[$filename])) {
|
||||||
return \React\Promise\Util::promiseFor(array('packages' => array()));
|
return PromiseUtil::promiseFor(array('packages' => array()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$httpDownloader = $this->httpDownloader;
|
$httpDownloader = $this->httpDownloader;
|
||||||
|
@ -1101,11 +1104,12 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
$url = $this->url;
|
$url = $this->url;
|
||||||
$cache = $this->cache;
|
$cache = $this->cache;
|
||||||
$degradedMode =& $this->degradedMode;
|
$degradedMode =& $this->degradedMode;
|
||||||
|
$repo = $this;
|
||||||
|
|
||||||
$accept = function ($response) use ($io, $url, $cache, $cacheKey) {
|
$accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $repo) {
|
||||||
// package not found is acceptable for a v2 protocol repository
|
// package not found is acceptable for a v2 protocol repository
|
||||||
if ($response->getStatusCode() === 404) {
|
if ($response->getStatusCode() === 404) {
|
||||||
$this->packagesNotFoundCache[$filename] = true;
|
$repo->packagesNotFoundCache[$filename] = true;
|
||||||
return array('packages' => array());
|
return array('packages' => array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,9 +1132,9 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
return $data;
|
return $data;
|
||||||
};
|
};
|
||||||
|
|
||||||
$reject = function ($e) use (&$retries, $httpDownloader, $filename, $options, &$reject, $accept, $io, $url, &$degradedMode) {
|
$reject = function ($e) use (&$retries, $httpDownloader, $filename, $options, &$reject, $accept, $io, $url, &$degradedMode, $repo) {
|
||||||
if ($e instanceof TransportException && $e->getStatusCode() === 404) {
|
if ($e instanceof TransportException && $e->getStatusCode() === 404) {
|
||||||
$this->packagesNotFoundCache[$filename] = true;
|
$repo->packagesNotFoundCache[$filename] = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue