Visitar URL original
Fix #627 - Accept ON as value in SET statements by predictor2718 · Pull Request #652 · phpmyadmin/sql-parser · GitHub
Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Simplify ON keyword check to only needed case
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
  • Loading branch information
predictor2718 committed Apr 13, 2026
commit 166fa166681ed8c924777ebb84a5879b887dff2b
11 changes: 10 additions & 1 deletion src/Components/SetOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading