Skip to content

Commit

Permalink
Fix self.version requirements failing the lock file integrity check i…
Browse files Browse the repository at this point in the history
…f on a different version, fixes #11274 (#11283)
  • Loading branch information
Seldaek committed Jan 27, 2023
1 parent 0a2846c commit ad7bc18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Composer/Package/Locker.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ public function getMissingRequirementInfo(RootPackageInterface $package, bool $i
if (PlatformRepository::isPlatformPackage($link->getTarget())) {
continue;
}
if ($link->getPrettyConstraint() === 'self.version') {
continue;
}
if ($installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint()) === []) {
$results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget());
if ($results !== []) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@
The locked version will not get overwritten by an install but fails on invalid packages
--COMPOSER--
{
"version": "1.2.3",
"repositories": [
{
"type": "package",
"package": [
{ "name": "foo/bar", "version": "1.0.0" },
{ "name": "foo/baz", "version": "1.0.0" },
{ "name": "foo/baz", "version": "2.0.0" }
{ "name": "foo/baz", "version": "2.0.0" },
{ "name": "foo/self", "version": "1.2.3" }
]
}
],
"require": {
"foo/bar": "2.0.0",
"foo/baz": "2.0.0"
"foo/baz": "2.0.0",
"foo/self": "self.version"
}
}
--LOCK--
{
"packages": [
{ "name": "foo/bar", "version": "1.0.0" },
{ "name": "foo/baz", "version": "2.0.0" }
{ "name": "foo/baz", "version": "2.0.0" },
{ "name": "foo/self", "version": "1.2.2" }
],
"packages-dev": [],
"aliases": [],
Expand Down

0 comments on commit ad7bc18

Please sign in to comment.