Skip to content

Commit f4b2a20

Browse files
committed
Merge branch '5.11.x'
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
2 parents 9d4796d + 4652d80 commit f4b2a20

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Parsers/Conditions.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ public static function parse(Parser $parser, TokensList $list, array $options =
129129
}
130130

131131
// Conditions are delimited by logical operators.
132-
if (in_array($token->value, self::DELIMITERS, true)) {
132+
if (
133+
($token->type === TokenType::Keyword || $token->type === TokenType::Operator)
134+
&& in_array($token->value, self::DELIMITERS, true)
135+
) {
133136
if ($betweenBefore && ($token->value === 'AND')) {
134137
// The syntax of keyword `BETWEEN` is hard-coded.
135138
$betweenBefore = false;

tests/Components/ConditionTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ public function testParseBetween(): void
2626
$this->assertEquals('OR', $component[1]->expr);
2727
$this->assertEquals('(id BETWEEN 30 AND 40)', $component[2]->expr);
2828
}
29+
30+
public function testParseAnd(): void
31+
{
32+
$component = Conditions::parse(new Parser(), $this->getTokensList("`col` LIKE 'AND'"));
33+
$this->assertEquals("`col` LIKE 'AND'", Conditions::buildAll($component));
34+
}
2935
}

0 commit comments

Comments
 (0)