DDC-612: Query\Expr::substring() third parameter should be optional #748

Open
opened 2026-01-22 12:49:07 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (May 25, 2010).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user @hobodave:

I'm not aware of a platform that requires all 3 arguments to SUBSTRING().

This seems to only affect queries from the QueryBuilder

The following DQL works fine:

UPDATE Common\Model\Location e SET e.path = CONCAT('00010002', SUBSTRING(e.path, 9)) WHERE e.path LIKE '00010001%'

Yet the following QueryBuilder expression:

$substr = $expr->substring('e.' . $this->getPathFieldName(), strlen($oldPath)+1);

results in:

Missing argument 3 for Doctrine\ORM\Query\Expr::substring()

If I make that argument optional, default null I get the following generated DQL and error:

"UPDATE Common\Model\Location e SET e.path = CONCAT('00010002', SUBSTRING(e.path, 9, )) WHERE e.path LIKE '00010001%'
Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 84: Error: Expected Literal, got ')'
Originally created by @doctrinebot on GitHub (May 25, 2010). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user @hobodave: I'm not aware of a platform that requires all 3 arguments to SUBSTRING(). This seems to only affect queries from the QueryBuilder The following DQL works fine: ``` UPDATE Common\Model\Location e SET e.path = CONCAT('00010002', SUBSTRING(e.path, 9)) WHERE e.path LIKE '00010001%' ``` Yet the following QueryBuilder expression: ``` $substr = $expr->substring('e.' . $this->getPathFieldName(), strlen($oldPath)+1); ``` results in: ``` Missing argument 3 for Doctrine\ORM\Query\Expr::substring() ``` If I make that argument optional, default null I get the following generated DQL and error: ``` "UPDATE Common\Model\Location e SET e.path = CONCAT('00010002', SUBSTRING(e.path, 9, )) WHERE e.path LIKE '00010001%' Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 84: Error: Expected Literal, got ')' ```
admin added the Improvement label 2026-01-22 12:49:07 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#748