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

Use $maxLength = 0 by default when calling PDOStatement::bindParam() #5145

Merged
merged 1 commit into from
Dec 28, 2021

Conversation

morozov
Copy link
Member

@morozov morozov commented Dec 28, 2021

Q A
Type bug
BC Break no

Fixes #5134.

@morozov morozov added this to the 3.2.1 milestone Dec 28, 2021
derrabus
derrabus previously approved these changes Dec 28, 2021
@morozov
Copy link
Member Author

morozov commented Dec 28, 2021

public function testBindParamWithNullLength(): void
{
$platform = $this->connection->getDatabasePlatform();
$query = $platform->getDummySelectSQL('?');
$stmt = $this->connection->prepare($query);
$value = 1;
$stmt->bindParam(1, $value, ParameterType::INTEGER, null);
self::assertEquals(1, $stmt->executeQuery()->fetchOne());
}

The previous (above) version of the test identifies some irrelevant platform-specific issue:

  1. On PostgreSQL < 10 (potential explanation):
    SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR:  could not determine data type of parameter $1
    
    It could be reproduced as simple as:
    PREPARE p AS SELECT $1
    -- [42P18] ERROR: could not determine data type of parameter $1
  2. On IBM DB2:
    db2_bind_param(): Describe Param Failed
    

So far, it doesn't look like something that the DBAL should take care of.

@morozov morozov merged commit d68b37a into doctrine:3.2.x Dec 28, 2021
@morozov morozov deleted the issues/5134 branch December 28, 2021 15:37
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PDOStatement::bindParam: Passing null to parameter $maxLength is deprecated
2 participants