Skip to content

Commit dc66e68

Browse files
committed
Fix REGEXP
1 parent 2834d5a commit dc66e68

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Phar.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ function php_strip_whitespace(string $file): string
3535
if (preg_match('!^(//|#[^\[]).*$!', $line)) {
3636
return null;
3737
}
38-
// Prevent processing non-comment lines (eg: containing php:// or http:// uris)
39-
// to be mistakenly treated as such
40-
return preg_replace('!\s(//|#[^\[]).*$!', '', $line);
41-
// Not working: breaks phpcc self-compiling
42-
//return preg_replace('!([^:])' . '(//|#[^\[])' . '.*$!', '$1', $line);
38+
// Prevent processing non-comment lines to be mistakenly treated as such
39+
// eg: context uris containing "php://" or "http://", or this regexp
40+
return preg_replace('!([^:(])(//|#[^\[]).*$!', '$1', $line);
4341
}, $lines);
4442

4543
// Second pass: multi-line comments

0 commit comments

Comments
 (0)