1
0
Fork 0

Change the content hash to be only based on values that affect dependency resolution

pull/4140/head
Zsolt Szeberenyi 2015-06-13 10:15:56 +02:00
parent 50b560fe4c
commit 3e0219c438
1 changed files with 21 additions and 2 deletions

View File

@ -496,7 +496,26 @@ class Factory
private function getContentHash($composerFilePath)
{
$content = json_decode(file_get_contents($composerFilePath), true);
ksort($content);
return md5(json_encode($content));
$relevantKeys = array(
'require',
'require-dev',
'conflict',
'replace',
'provide',
'suggest',
'minimum-stability',
'prefer-stable',
'repositories',
);
$relevantContent = array();
foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
$relevantContent[$key] = $content[$key];
}
ksort($relevantContent);
return md5(json_encode($relevantContent));
}
}