diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 42fcaf3d8..056c4babc 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -743,7 +743,7 @@ FOOTER; $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path; if ($type === 'files') { - $autoloads[$this->getFileIdentifier($package, $relativePath)] = $relativePath; + $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath; continue; } elseif ($type === 'classmap') { $autoloads[] = $relativePath; @@ -760,7 +760,7 @@ FOOTER; protected function getFileIdentifier(PackageInterface $package, $path) { - return md5($package->getName() . ':' . str_replace("\r\n", "\n", file_get_contents($path))); + return md5($package->getName() . ':' . $path); } /** diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index a2894c639..ce33801ac 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -653,7 +653,7 @@ class AutoloadGeneratorTest extends TestCase public function testFilesAutoloadOrderByDependencies() { $package = new Package('a', '1.0', '1.0'); - $package->setAutoload(array('files' => array('root.php'))); + $package->setAutoload(array('files' => array('root2.php'))); $package->setRequires(array(new Link('a', 'z/foo'))); $package->setRequires(array(new Link('a', 'd/d'))); $package->setRequires(array(new Link('a', 'e/e'))); @@ -693,7 +693,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->vendorDir . '/c/lorem/testC.php', 'vendorDir . '/d/d/testD.php', 'vendorDir . '/e/e/testE.php', 'workingDir . '/root.php', 'workingDir . '/root2.php', 'generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoloadOrder'); $this->assertFileEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php'); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_files2.php b/tests/Composer/Test/Autoload/Fixtures/autoload_files2.php index b23ccba93..8972cdda8 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_files2.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_files2.php @@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'ca64fb7d3f21566080b945f028f30a2e' => $baseDir . '/devfiles/foo.php', + 'e5e597abc575cc420a44914c612bb1b3' => $baseDir . '/devfiles/foo.php', ); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions.php b/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions.php index ae7ffe461..ca7d7ea05 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions.php @@ -6,9 +6,9 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - '358464b1e68dac136ef7d2ec6242b425' => $vendorDir . '/a/a/test.php', - '03c187060069af833190628645c24aca' => $vendorDir . '/b/b/test2.php', - 'e6a1485c8598883535f318df5b64632f' => $vendorDir . '/c/c/foo/bar/test3.php', - 'c1fb30d7fed4befd8653c015f6c004f6' => $vendorDir . '/c/c/foo/bar/test4.php', - '168fcd186353db6d3200ede690c8cfa8' => $baseDir . '/root.php', + '6d9003eea93a81f3586b5d9c5bd91272' => $vendorDir . '/a/a/test.php', + 'e56cac94f86c787e1efd645809df361d' => $vendorDir . '/b/b/test2.php', + 'df8470dfa2ebd6b31da05b60fb4ec29a' => $vendorDir . '/c/c/foo/bar/test3.php', + '68f1e24e6cd39de885cb5a47678e6518' => $vendorDir . '/c/c/foo/bar/test4.php', + '61b776fd0ee84fb7d7d958ae46118ded' => $baseDir . '/root.php', ); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions_with_removed_extra.php b/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions_with_removed_extra.php index 725839abe..c584e079a 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions_with_removed_extra.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_files_functions_with_removed_extra.php @@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - '168fcd186353db6d3200ede690c8cfa8' => $baseDir . '/root.php', + '61b776fd0ee84fb7d7d958ae46118ded' => $baseDir . '/root.php', ); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_files_target_dir.php b/tests/Composer/Test/Autoload/Fixtures/autoload_files_target_dir.php index d5bfd778e..5e0c1e6a3 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_files_target_dir.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_files_target_dir.php @@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - '8d2db77ca7611f10a41ca43619ad167f' => $baseDir . '/foo.php', - '54c6b911effcf924f7ff3e89a29f9217' => $baseDir . '/bar.php', + 'b419c11b924de79ffa740afc29a3dc16' => $baseDir . '/foo.php', + 'f558c96fbd0535aaa98981fa59ff7594' => $baseDir . '/bar.php', );