From 79b20e7544ddfcb0027aeeca9cfcbd0b15a04cb8 Mon Sep 17 00:00:00 2001 From: shokre Date: Wed, 19 Sep 2018 13:53:46 +0200 Subject: [PATCH] Fix for issue 233 comments not parsing when they have a quote Fixes failing issue233Test Ignore string rules when in comment --- src/PHPSQLParser/lexer/PHPSQLLexer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PHPSQLParser/lexer/PHPSQLLexer.php b/src/PHPSQLParser/lexer/PHPSQLLexer.php index be2e1be5..326c8c03 100644 --- a/src/PHPSQLParser/lexer/PHPSQLLexer.php +++ b/src/PHPSQLParser/lexer/PHPSQLLexer.php @@ -212,6 +212,7 @@ protected function concatComments($tokens) { $cnt = count($tokens); $comment = false; $in_string = false; + $inline = false; while ($i < $cnt) { if (!isset($tokens[$i])) { @@ -220,7 +221,7 @@ protected function concatComments($tokens) { } $token = $tokens[$i]; - if($token == "\"" || $token == "'") { + if($comment === false && ($token == "\"" || $token == "'")) { $in_string = !$in_string; } if(!$in_string) {