From 166fa166681ed8c924777ebb84a5879b887dff2b Mon Sep 17 00:00:00 2001 From: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> Date: Mon, 13 Apr 2026 16:30:23 +0200 Subject: [PATCH 1/2] Simplify ON keyword check to only needed case Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> --- src/Components/SetOperation.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 2faf0c611..5a391e9c6 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -113,12 +113,21 @@ public static function parse(Parser $parser, TokensList $list, array $options = $commaLastSeenAt = $token; } } elseif ($state === 1) { + // Reserved keywords like ON are valid values in SET statements + // (e.g. SET @@sql_log_bin = ON). Try parsing as expression first, + // and if that fails, accept reserved keywords as literal values. $tmp = Expression::parse( $parser, $list, ['breakOnAlias' => true] ); - if ($tmp === null) { + if ( + $tmp === null + && $token->type === Token::TYPE_KEYWORD + && $token->value === 'ON' + ) { + $tmp = new Expression($token->token); + } elseif ($tmp === null) { $parser->error('Missing expression.', $token); break; } From 0bd40a6b3fd1cc0bc12b3ea0a970873c8dcfc711 Mon Sep 17 00:00:00 2001 From: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> Date: Mon, 13 Apr 2026 16:49:05 +0200 Subject: [PATCH 2/2] Fix phpcs: place if condition on single line Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> --- src/Components/SetOperation.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 5a391e9c6..d2726180a 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -121,11 +121,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = $list, ['breakOnAlias' => true] ); - if ( - $tmp === null - && $token->type === Token::TYPE_KEYWORD - && $token->value === 'ON' - ) { + if ($tmp === null && $token->type === Token::TYPE_KEYWORD && $token->value === 'ON') { $tmp = new Expression($token->token); } elseif ($tmp === null) { $parser->error('Missing expression.', $token);