From ea61748fa2aff48e74e875e05a2f592cdcafc6a1 Mon Sep 17 00:00:00 2001 From: Nicolas Giraud Date: Mon, 26 Aug 2024 18:23:12 +0200 Subject: [PATCH] Fix empty SET operations now throw error. --- src/Components/SetOperation.php | 5 +++++ tests/data/parser/parseUpdateEmptySet.out | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 2faf0c611..104f71d9a 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -139,6 +139,11 @@ public static function parse(Parser $parser, TokensList $list, array $options = $parser->error('Unexpected token.', $commaLastSeenAt); } + // We got a SET operation without any assignment + if ($ret === []) { + $parser->error('Missing assignment in SET operation.', $list->tokens[$list->idx]); + } + return $ret; } diff --git a/tests/data/parser/parseUpdateEmptySet.out b/tests/data/parser/parseUpdateEmptySet.out index ce0632dfb..dbeff527f 100644 --- a/tests/data/parser/parseUpdateEmptySet.out +++ b/tests/data/parser/parseUpdateEmptySet.out @@ -171,6 +171,14 @@ }, "errors": { "lexer": [], - "parser": [] + "parser": [ + [ + "Missing assignment in SET operation.", + { + "@type": "@7" + }, + 0 + ] + ] } } \ No newline at end of file