[aur-dev] [PATCH] pkgsubmit.php: Fix comment parsing in arrays

Neer Sighted neersighted at myopera.com
Wed Feb 27 22:04:56 EST 2013


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



More information about the aur-dev mailing list