瀏覽代碼

Only lines starting with a # should be treated as comments, fixes #3066

Jordi Boggiano 11 年之前
父節點
當前提交
f53994fcf2
共有 1 個文件被更改,包括 6 次插入9 次删除
  1. 6 9
      src/Composer/Package/Archiver/BaseExcludeFilter.php

+ 6 - 9
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;
             }