diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 1e62a1122..e49b16bc3 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -137,7 +137,7 @@ EOF; file_put_contents($targetDir.'/include_paths.php', $includePathFile); } file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix)); - file_put_contents($targetDir.'/autoload_real'.$suffix.'.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $suffix)); + file_put_contents($targetDir.'/autoload_real'.$suffix.'.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix)); copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); } @@ -295,7 +295,7 @@ return ComposerAutoloaderInit$suffix::getLoader(); AUTOLOAD; } - protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $suffix) + protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix) { // TODO the class ComposerAutoloaderInit should be revert to a closure // when APC has been fixed: @@ -321,6 +321,8 @@ class ComposerAutoloaderInit$suffix public static function getLoader() { \$loader = new \\Composer\\Autoload\\ClassLoader(); + \$vendorDir = $vendorPathCode; + \$baseDir = $appBaseDirCode; HEADER; diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php index 90451e69c..e33ff4fc9 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php @@ -10,6 +10,8 @@ class ComposerAutoloaderInitFilesAutoload public static function getLoader() { $loader = new \Composer\Autoload\ClassLoader(); + $vendorDir = dirname(__DIR__); + $baseDir = dirname($vendorDir); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php index 1e4f7178c..7ed23490b 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php @@ -10,6 +10,8 @@ class ComposerAutoloaderInitTargetDir public static function getLoader() { $loader = new \Composer\Autoload\ClassLoader(); + $vendorDir = dirname(__DIR__); + $baseDir = dirname($vendorDir); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) {