From 914c400a7d1446f4bcfc23113516a2299660352a Mon Sep 17 00:00:00 2001 From: Mathew Davies Date: Thu, 8 Jun 2017 17:22:07 +0100 Subject: [PATCH] Check for custom functions first. --- lib/Doctrine/ORM/Query/Parser.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 34679ff61..c8294be36 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -3376,8 +3376,13 @@ class Parser $token = $this->lexer->lookahead; $funcName = strtolower($token['value']); - // Check for built-in functions first! + $customFunctionDeclaration = $this->CustomFunctionDeclaration(); + + // Check for custom functions functions first! switch (true) { + case $customFunctionDeclaration !== null: + return $customFunctionDeclaration; + case (isset(self::$_STRING_FUNCTIONS[$funcName])): return $this->FunctionsReturningStrings(); @@ -3388,7 +3393,7 @@ class Parser return $this->FunctionsReturningDatetime(); default: - return $this->CustomFunctionDeclaration(); + $this->syntaxError('known function', $token); } } @@ -3416,7 +3421,7 @@ class Parser return $this->CustomFunctionsReturningDatetime(); default: - $this->syntaxError('known function', $token); + return null; } }