1
0
Fork 0

Fix require command skipping new stability-flags from the lock file, fixes #11698 (#12112)

pull/12086/head
Jordi Boggiano 2024-09-18 09:16:31 +02:00 committed by GitHub
parent c2b1667cac
commit 07248f4323
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -561,10 +561,16 @@ EOT
}
$lockFile = Factory::getLockFile($this->json->getPath());
if (file_exists($lockFile)) {
$stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $composer->getPackage()->getMinimumStability(), []);
$lockMtime = filemtime($lockFile);
$lock = new JsonFile($lockFile);
$lockData = $lock->read();
$lockData['content-hash'] = Locker::getContentHash($contents);
foreach ($stabilityFlags as $packageName => $flag) {
$lockData['stability-flags'][$packageName] = $flag;
}
ksort($lockData['stability-flags']);
$lock->write($lockData);
if (is_int($lockMtime)) {
@touch($lockFile, $lockMtime);

View File

@ -373,6 +373,8 @@ class Locker
'prefer-lowest' => $preferLowest,
];
ksort($lock['stability-flags']);
$lock['packages'] = $this->lockPackages($packages);
if (null !== $devPackages) {
$lock['packages-dev'] = $this->lockPackages($devPackages);