diff --git a/src/Query/Parser.php b/src/Query/Parser.php index 949a8f4ebd..10cb008d12 100644 --- a/src/Query/Parser.php +++ b/src/Query/Parser.php @@ -2924,7 +2924,10 @@ public function ArithmeticPrimary() return new AST\ParenthesisExpression($expr); } - assert($this->lexer->lookahead !== null); + if ($this->lexer->lookahead === null) { + $this->syntaxError('ArithmeticPrimary'); + } + switch ($this->lexer->lookahead->type) { case TokenType::T_COALESCE: case TokenType::T_NULLIF: diff --git a/tests/Tests/ORM/Functional/Ticket/GH11487Test.php b/tests/Tests/ORM/Functional/Ticket/GH11487Test.php new file mode 100644 index 0000000000..ef036e48ad --- /dev/null +++ b/tests/Tests/ORM/Functional/Ticket/GH11487Test.php @@ -0,0 +1,40 @@ +expectException(QueryException::class); + $this->expectExceptionMessage('Syntax Error'); + $this->_em->createQuery('UPDATE Doctrine\Tests\ORM\Functional\Ticket\TaxType t SET t.default =')->execute(); + } +} + +/** @Entity */ +class TaxType +{ + /** + * @var int|null + * @Column(type="integer") + * @Id + * @GeneratedValue + */ + public $id; + + /** + * @var bool + * @Column(type="boolean") + */ + public $default = false; +}