Explorar o código

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

Zsolt Szeberenyi %!s(int64=10) %!d(string=hai) anos
pai
achega
3e0219c438
Modificáronse 1 ficheiros con 21 adicións e 2 borrados
  1. 21 2
      src/Composer/Factory.php

+ 21 - 2
src/Composer/Factory.php

@@ -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));
     }
 }