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

PDOStatement::bindParam: Passing null to parameter $maxLength is deprecated #5134

Closed
Jeroeny opened this issue Dec 20, 2021 · 4 comments · Fixed by #5145
Closed

PDOStatement::bindParam: Passing null to parameter $maxLength is deprecated #5134

Jeroeny opened this issue Dec 20, 2021 · 4 comments · Fixed by #5145

Comments

@Jeroeny
Copy link

Jeroeny commented Dec 20, 2021

Bug Report

Q A
BC Break no
Version 3.2.0

Summary

When running doctrine/dbal 3.2.0 in PHP 8.1, a deprecation warning is thrown:

PDOStatement::bindParam(): Passing null to parameter # 4 ($maxLength) of type int is deprecated in /app/vendor/doctrine/dbal/src/Driver/PDO/Statement.php on line 84

Current behaviour

A deprecation warning is thrown.

How to reproduce

By using the Doctrine\DBAL\Driver\PDO\Statement::bindParam() method.

Expected behaviour

I don't know if it's known that this deprecation isn't fixed yet, it's intended to not have been fixed or that an issue already exists. But I couldn't find anything about it yet.

@morozov
Copy link
Member

morozov commented Dec 21, 2021

By using the Doctrine\DBAL\Driver\PDO\Statement::bindParam() method.

I assume you're explicitly passing NULL to bindParam(), aren't you? For instance,

$value = 1;
$stmt = $connection->prepare('SELECT ?');
$stmt->bindParam(1, $value, ParameterType::INTEGER, null);
$stmt->executeQuery();

// Deprecated: PDOStatement::bindParam(): Passing null to parameter #4 ($maxLength) of type int is deprecated in /src/Driver/PDO/Statement.php

@Jeroeny
Copy link
Author

Jeroeny commented Dec 27, 2021

That's indeed what is happening. It occurred in getsentry/sentry-symfony, fixing it there: getsentry/sentry-symfony#586

@Jeroeny Jeroeny closed this as completed Dec 27, 2021
@morozov
Copy link
Member

morozov commented Dec 27, 2021

Reopening since this is still a bug.

@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 Jul 22, 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.

3 participants