Closed
Description
If the same statement is used with different parameters, the sqlsrv driver always inserts the first set of values. An attempt to bind a new value using bindValue()
has no effect.
$em->getConnection()->beginTransaction();
$stmt = $em->getConnection()->prepare('INSERT INTO ... VALUES (?)');
$first = 'first';
$stmt->bindValue(1, $first, 'string');
$stmt->execute();
$second= 'second';
$stmt->bindValue(1, $second, 'string');
$stmt->execute();
$stmt->closeCursor();
$em->getConnection()->commit();
After the transaction completes, it contains two times first
but no second
. This also affects the ORM, if two entities of the same type are inserted.
Tested with
- PHP 7.1.1, sqlsrv ext 4.1.4, DBAL 2.5.11
- PHP 7.0, SQLSRV40, DBAL 2.5.11