From f53994fcf26817d6367f2e63f9e3150eed37ec71 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 29 Jun 2014 16:17:44 +0200 Subject: [PATCH] Only lines starting with a # should be treated as comments, fixes #3066 --- .../Package/Archiver/BaseExcludeFilter.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Composer/Package/Archiver/BaseExcludeFilter.php b/src/Composer/Package/Archiver/BaseExcludeFilter.php index dca24eb67..d724f31e4 100644 --- a/src/Composer/Package/Archiver/BaseExcludeFilter.php +++ b/src/Composer/Package/Archiver/BaseExcludeFilter.php @@ -82,17 +82,14 @@ abstract class BaseExcludeFilter function ($line) use ($lineParser) { $line = trim($line); - $commentHash = strpos($line, '#'); - if ($commentHash !== false) { - $line = substr($line, 0, $commentHash); + if (!$line || 0 === strpos($line, '#')) { + return; } - if ($line) { - return call_user_func($lineParser, $line); - } - - return null; - }, $lines), + return call_user_func($lineParser, $line); + }, + $lines + ), function ($pattern) { return $pattern !== null; }