Fix the comment parsing in arrays, so that a hash in a one-line array does not get parsed as a comment.
-- Neer Sighted, Hacker http://neersighted.com | [email protected] {01DC2056}
From aa7f2fb6f2b664f7aaebb08cd78695c7a8a786b2 Mon Sep 17 00:00:00 2001 From: Neer Sighted <[email protected]> Date: Wed, 27 Feb 2013 17:03:23 -0800 Subject: [PATCH] pkgsubmit.php: Fix comment parsing in arrays Fix the comment parsing in arrays, so that a hash in a one-line array does not get parsed as a comment. --- web/html/pkgsubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index fefb31e..dbc8a00 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -130,7 +130,7 @@ if ($uid): foreach (explode("\n", $pkgbuild_raw) as $line) { $line = trim($line); # Remove comments - $line = preg_replace('/\s*#.*/', '', $line); + $line = preg_replace('/\s*#.*(?:[^"'][^\)])$/', '', $line); $char_counts = count_chars($line, 0); $paren_depth += $char_counts[ord('(')] - $char_counts[ord(')')]; -- 1.8.1.4
