php-debugbar icon indicating copy to clipboard operation
php-debugbar copied to clipboard

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

Open senyahnoj opened this issue 5 years ago • 0 comments

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.

senyahnoj avatar Nov 05 '20 14:11 senyahnoj