Skip to content

Commit 59b42aa

Browse files
committed
bug #580 Fix computing the intersection of Symfony components with extra.symfony.require (nicolas-grekas)
This PR was merged into the 1.5-dev branch. Discussion ---------- Fix computing the intersection of Symfony components with extra.symfony.require A constraint like `">5.0.0,<5.1"` in `SYMFONY_REQUIRE` doesn't work right now, this fixes it. Commits ------- 38f2f20 Fix comparing dev-versions of Symfony components
2 parents 45ec028 + 38f2f20 commit 59b42aa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Cache.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,22 @@ private function getVersions(): array
117117

118118
$versions = $this->downloader->getVersions();
119119
$this->downloader = null;
120+
$okVersions = [];
120121

121122
foreach ($versions['splits'] as $name => $vers) {
122123
foreach ($vers as $i => $v) {
123-
$v = $this->versionParser->normalize($v);
124+
if (!isset($okVersions[$v])) {
125+
$okVersions[$v] = false;
126+
127+
for ($j = 0; $j < 60; ++$j) {
128+
if ($this->symfonyConstraints->matches(new Constraint('==', $v.'.'.$j.'.0'))) {
129+
$okVersions[$v] = true;
130+
break;
131+
}
132+
}
133+
}
124134

125-
if (!$this->symfonyConstraints->matches(new Constraint('==', $v))) {
135+
if (!$okVersions[$v]) {
126136
unset($vers[$i]);
127137
}
128138
}

0 commit comments

Comments
 (0)