From adaa7889550840827b9f8e5e49a19a14b9468d69 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 25 Jun 2012 11:39:51 +0200 Subject: [PATCH] Require file autoloads after the autoloader is registered --- src/Composer/Autoload/AutoloadGenerator.php | 12 ++++++------ .../Test/Autoload/Fixtures/autoload_functions.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 3c59ffaf7..177a03a13 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -124,7 +124,7 @@ EOF; $filesCode = ""; $autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files'])); foreach ($autoloads['files'] as $functionFile) { - $filesCode .= 'require __DIR__ . '. var_export('/'.$filesystem->findShortestPath($vendorPath, $functionFile), true).";\n"; + $filesCode .= ' require __DIR__ . '. var_export('/'.$filesystem->findShortestPath($vendorPath, $functionFile), true).";\n"; } file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); @@ -286,7 +286,7 @@ EOF; if (!class_exists('Composer\\\\Autoload\\\\ClassLoader', false)) { require $vendorPathToTargetDirCode . '/ClassLoader.php'; } -$filesCode + return call_user_func(function() { \$loader = new \\Composer\\Autoload\\ClassLoader(); \$composerDir = $vendorPathToTargetDirCode; @@ -328,10 +328,10 @@ CLASSMAP; $file .= $targetDirLoader; - return $file . <<<'FOOTER' - $loader->register(); - - return $loader; + return $file . <<