From 51404659ef4adc27de94c623aa43888f5c1f7892 Mon Sep 17 00:00:00 2001 From: Sylvain Filteau Date: Fri, 6 Jul 2012 14:17:27 -0400 Subject: [PATCH] Change the order of the include paths Composer installed libraries should have precedence over other libraries in the system (like PEAR installed libraries). Made composer prepend it's include_path configuration instead of appending it. --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 82e223342..f86489214 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -300,7 +300,7 @@ HEADER; if ($useIncludePath) { $file .= <<<'INCLUDE_PATH' $includePaths = require $composerDir . '/include_paths.php'; - array_unshift($includePaths, get_include_path()); + array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index f39248d33..e3b91127d 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -338,7 +338,7 @@ class AutoloadGeneratorTest extends TestCase ); } - public function testIncludePathsAreAppendedInAutoloadFile() + public function testIncludePathsArePrependedInAutoloadFile() { $package = new MemoryPackage('a', '1.0', '1.0'); $packages = array(); @@ -361,7 +361,7 @@ class AutoloadGeneratorTest extends TestCase require($this->vendorDir."/autoload.php"); $this->assertEquals( - $oldIncludePath.PATH_SEPARATOR.$this->vendorDir."/a/a/lib", + $this->vendorDir."/a/a/lib".PATH_SEPARATOR.$oldIncludePath, get_include_path() );