1
0
Fork 0

Fix self.version requirements failing the lock file integrity check if on a different version, fixes #11274 (#11283)

pull/11292/head
Jordi Boggiano 2023-01-27 16:54:45 +01:00 committed by GitHub
parent 0a2846cb24
commit ad7bc18028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -518,6 +518,9 @@ class Locker
if (PlatformRepository::isPlatformPackage($link->getTarget())) { if (PlatformRepository::isPlatformPackage($link->getTarget())) {
continue; continue;
} }
if ($link->getPrettyConstraint() === 'self.version') {
continue;
}
if ($installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint()) === []) { if ($installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint()) === []) {
$results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget()); $results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget());
if ($results !== []) { if ($results !== []) {

View File

@ -2,26 +2,30 @@
The locked version will not get overwritten by an install but fails on invalid packages The locked version will not get overwritten by an install but fails on invalid packages
--COMPOSER-- --COMPOSER--
{ {
"version": "1.2.3",
"repositories": [ "repositories": [
{ {
"type": "package", "type": "package",
"package": [ "package": [
{ "name": "foo/bar", "version": "1.0.0" }, { "name": "foo/bar", "version": "1.0.0" },
{ "name": "foo/baz", "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": { "require": {
"foo/bar": "2.0.0", "foo/bar": "2.0.0",
"foo/baz": "2.0.0" "foo/baz": "2.0.0",
"foo/self": "self.version"
} }
} }
--LOCK-- --LOCK--
{ {
"packages": [ "packages": [
{ "name": "foo/bar", "version": "1.0.0" }, { "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": [], "packages-dev": [],
"aliases": [], "aliases": [],