Skip to content

Loading…

DBAL-526: Doctrine\DBAL\Connection::executeQuery changes passed clause #1732

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user coviex:

vardump(getclass($db));

string(24) "Doctrine\DBAL\Connection"

var_dump($params);

array(2) {
[0] =>
int(18)
[1] =>
int(0)
}

$stmt = $db->executeQuery('SELECT l0.id AS id0 FROM link l0_ WHERE l0_.user_id = ? AND l0_.is_deleted = ?', array($params), array(\Doctrine\DBAL\Connection::PARAM_INTARRAY));

An exception occurred while executing 'SELECT l0.id AS id0 FROM link l0_ WHERE l0_.user_id = ?, ? AND l0_.isdeleted = ?' with params [18, 0]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

$stmt = $db->executeQuery('SELECT l0.id AS id0 FROM link l0_ WHERE l0_.user_id = ? AND l0_.is_deleted = ?', $params, array(\PDO::PARAM_INT, \PDO::PARAMINT));
var_dump($stmt->fetchAll());

array(0) {
}

@doctrinebot

Comment created by @FabioBatSilva:

[~coviex] this is the expected behaviour,
If you use "Connection::PARAMINTARRAY" the given array parameter will be expanded.

@doctrinebot

Issue was closed with resolution "Invalid"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.