Skip to content

TracedStatement::getSqlWithParameters() getting bindings wrong for SQL statements using BETWEEN #457

@senyahnoj

Description

@senyahnoj

This worked in 1.15.0 and, following an upgrade to the latest 1.16.3 it returning incorrectly
Take the following code:

use DebugBar\DataCollector\PDO\TracedStatement;

$query = 'select * from `my_table` where `my_field` between ? and ?';
$bindings = [
    '2018-01-01',
    '2020-09-01',
];

echo (new TracedStatement($query, $bindings))->getSqlWithParams();

In 1.15.0 it (correctly) returns

select * from `my_table` where `my_field` between <2018-01-01> and <2020-09-01>

In 1.16.3 it (incorrectly) returns

select * from `my_table` where `my_field` between <2018-01-01> and <2018-01-01>

It looks as if the first binding is being put in twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions