mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Using multiple parameters as arguments for SUBSTRING() fails
#6451
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @patrick-vandy on GitHub (Apr 21, 2020).
Bug Report
Summary
Using multiple named parameters as arguments to
SUBSTRING()results in the order of the parameters getting switched around and yields unexpected results.Current behavior
When using
SUBSTRING(:foo, 1, :pos)in a query builder and callingsetParameter('foo', 'foobar')andsetParameter('pos', 3), the order of the parameters gets switched and the generated PDO query passes3as the value of:fooandfoobaras the value of:pos.How to reproduce
Using Oracle Database 12c (12.2.0.1.0):
This results in an
Invalid Numbererror becausefoobaris provided as the value of:pos. In the exception, you can see that the generated PDO query is using?placeholders and has the order of the parameters mixed up:Switching the parameters around in the
setParametermethods yields the expected result:Note: I have not tested this on other database vendors, so I do not know if this is specific to Oracle or will occur using any database vendors.
Expected behavior
The value of
substrFieldshould befoo