Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryBuilder uses 1-based positional parameter keys #4421

Closed
morozov opened this issue Nov 11, 2020 · 1 comment · Fixed by #4422
Closed

QueryBuilder uses 1-based positional parameter keys #4421

morozov opened this issue Nov 11, 2020 · 1 comment · Fixed by #4422

Comments

@morozov
Copy link
Member

morozov commented Nov 11, 2020

Bug Report

Q A
BC Break no
Version 2.12.1

Summary

According to the documentation,

The numerical parameters in the QueryBuilder API start with the needle
``0``, not with ``1`` as in the PDO API.

The usage of non-zero-based keys has been explicitly deprecated in #4411. The issue was discovered during the work on #4397 which enforces this deprecation.

Current behaviour

When using QueryBuilder::createPositionalParameter(), the keys are created starting from 1.

How to reproduce

$qb = $conn->createQueryBuilder();
$qb->select($qb->createPositionalParameter('FOO'));

var_dump($qb->getParameters());
// array(1) {
//   [1] =>
//   string(3) "FOO"
// }

Expected behaviour

// array(1) {
//   [0] =>
//   string(3) "FOO"
// }
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant