From ede2b37ae2b4cf6af81463de6aaca82ec610fd87 Mon Sep 17 00:00:00 2001 From: Alan Hollis Date: Fri, 30 Aug 2013 11:46:39 +0100 Subject: [PATCH 1/4] 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/4] 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; } From 2bf90b544a3ec04b83a1d565759735edd1d187f1 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 31 Aug 2013 15:22:08 +0200 Subject: [PATCH 3/4] Fix parsing of trunk in SvnDriver, fixes composer/satis#88 --- src/Composer/Repository/Vcs/SvnDriver.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index b979c2e4b..c5a67b455 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -193,7 +193,13 @@ class SvnDriver extends VcsDriver if (null === $this->branches) { $this->branches = array(); - $output = $this->execute('svn ls --verbose', $this->baseUrl . '/'); + if (false === strpos($this->trunkPath, '/')) { + $trunkParent = $this->baseUrl . '/'; + } else { + $trunkParent = $this->baseUrl . '/' . dirname($this->trunkPath) . '/'; + } + + $output = $this->execute('svn ls --verbose', $trunkParent); if ($output) { foreach ($this->process->splitLines($output) as $line) { $line = trim($line); From a080ae3a51a16e1cbfe0c881797dba869cef95af Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 31 Aug 2013 15:42:26 +0200 Subject: [PATCH 4/4] Make sure directories we are downloading to are empty We already clear them on error anyway and usually they should be empty, but just to be safe. --- src/Composer/Downloader/FileDownloader.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 8ed0712bf..e67693563 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -79,6 +79,7 @@ class FileDownloader implements DownloaderInterface throw new \InvalidArgumentException('The given package is missing url information'); } + $this->filesystem->removeDirectory($path); $this->filesystem->ensureDirectoryExists($path); $fileName = $this->getFileName($package, $path);