You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: TestPDOStatement::bindParam() and bindColumn() lose the reference #23
TestPDOStatement::bindParam() and bindColumn() drop the by-reference binding. Both forward with $this->statement->bindParam(...\func_get_args()), and func_get_args() returns copies, so the inner statement binds a temporary instead of the caller's variable:
a value assigned to the variable after bindParam() never reaches the query;
a variable bound with bindColumn() is never filled on fetch.
Raw PDO behaves as expected in both cases.
Is this a regression?
No.
To Reproduce
$stmt = $pdo->prepare('SELECT ? AS v'); // $pdo is the harness's TestPDO$v = 1;
$stmt->bindParam(1, $v);
$v = 2;
$stmt->execute();
$stmt->fetchColumn(); // 1 with TestPDOStatement, 2 with raw PDO
Expected behaviour
The same as \PDOStatement: pass $var by reference, e.g. $this->statement->bindParam($param, $var, $type, ...) with the remaining arguments forwarded explicitly.
Found while raising coverage in #22. Nothing in the harness depends on it today: the only caller is SQL Server's LOB binding, which executes right after binding.
Activity