From ede2b37ae2b4cf6af81463de6aaca82ec610fd87 Mon Sep 17 00:00:00 2001 From: Alan Hollis Date: Fri, 30 Aug 2013 11:46:39 +0100 Subject: [PATCH 1/2] Fix parse error thrown in PHP5.5+ When running composer update the file generated by AutoloadGenerator was not able to be parsed by php due to a require statement inside the foreach loop. The fix is to make the statement work the same as the autoload_namespaces.php require is done. Issue occured using the following php versions PHP 5.5.1-2+debphp.org~precise+2 PHP 5.5.3-1+debphp.org~precise+2 --- src/Composer/Autoload/AutoloadGenerator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index b0fe9b232..512b25f84 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -460,9 +460,10 @@ REGISTER_AUTOLOAD; REGISTER_LOADER; if ($useIncludeFiles) { - $file .= << Date: Fri, 30 Aug 2013 12:09:17 +0000 Subject: [PATCH 2/2] Fix file layout in unit tests Changes made in previious commit made the output of the file change, which in turn broke the unit tests. This commit updates the fixtures to match the new output. --- .../Autoload/Fixtures/autoload_real_files_by_dependency.php | 3 ++- .../Test/Autoload/Fixtures/autoload_real_functions.php | 3 ++- .../Test/Autoload/Fixtures/autoload_real_target_dir.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php index 376f8512c..9321b86c8 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php @@ -38,7 +38,8 @@ class ComposerAutoloaderInitFilesAutoloadOrder $loader->register(true); - foreach (require __DIR__ . '/autoload_files.php' as $file) { + $includeFiles = require __DIR__ . '/autoload_files.php'; + foreach ($includeFiles as $file) { require $file; } diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php index 3ddbc9ca9..6407c93b7 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php @@ -38,7 +38,8 @@ class ComposerAutoloaderInitFilesAutoload $loader->register(true); - foreach (require __DIR__ . '/autoload_files.php' as $file) { + $includeFiles = require __DIR__ . '/autoload_files.php'; + foreach ($includeFiles as $file) { require $file; } 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 347454fc5..32e155422 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php @@ -40,7 +40,8 @@ class ComposerAutoloaderInitTargetDir $loader->register(true); - foreach (require __DIR__ . '/autoload_files.php' as $file) { + $includeFiles = require __DIR__ . '/autoload_files.php'; + foreach ($includeFiles as $file) { require $file; }