DDC-2668: DQL TRIM function is not converted into TRIM SQL correctly #3344

Closed
opened 2026-01-22 14:18:23 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Sep 10, 2013).

Jira issue originally created by user slavik2121:

Hi!

Using DQL to generate SQL TRIM code won't trim '0'.
For ex., this expression doesn't work:

$queryBuilder->andWhere("TRIM (LEADING '0' FROM t.field) LIKE :field")

This is happening as whenever TRIM DQL is converted into SQL, trimming character is checked for being 'false' multiple times. In php, both 0 and '0' are equaled to false.

{quote}
doctrine/orm/lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php:61
doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:640
{quote}

Originally created by @doctrinebot on GitHub (Sep 10, 2013). Jira issue originally created by user slavik2121: Hi! Using DQL to generate SQL TRIM code won't trim '0'. For ex., this expression doesn't work: ``` $queryBuilder->andWhere("TRIM (LEADING '0' FROM t.field) LIKE :field") ``` This is happening as whenever TRIM DQL is converted into SQL, trimming character is checked for being 'false' multiple times. In php, both 0 and '0' are equaled to false. {quote} doctrine/orm/lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php:61 doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:640 {quote}
admin added the Bug label 2026-01-22 14:18:23 +01:00
admin closed this issue 2026-01-22 14:18:24 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 26, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Sep 26, 2013): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3344