diff --git a/src/Driver/IBMDB2/Statement.php b/src/Driver/IBMDB2/Statement.php index 15c3fdb588a..699e236d715 100644 --- a/src/Driver/IBMDB2/Statement.php +++ b/src/Driver/IBMDB2/Statement.php @@ -182,6 +182,8 @@ private function bindLobs(): array } else { $this->bind($param, $value, DB2_PARAM_IN, DB2_CHAR); } + + unset($value); } return $handles; diff --git a/tests/Functional/Driver/IBMDB2/StatementTest.php b/tests/Functional/Driver/IBMDB2/StatementTest.php index 95b0ccdcf57..3bfe8672c8b 100644 --- a/tests/Functional/Driver/IBMDB2/StatementTest.php +++ b/tests/Functional/Driver/IBMDB2/StatementTest.php @@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Tests\Functional\Driver\IBMDB2; use Doctrine\DBAL\Driver\IBMDB2\Exception\StatementError; +use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\TestUtil; @@ -36,4 +37,16 @@ public function testExecutionErrorsAreNotSuppressed(): void $this->expectException(StatementError::class); $stmt->execute([[]]); } + + public function testBlobBindingDoesNotOverwritePrevious(): void + { + $params = ['test1', 'test2']; + $values = $this->connection->fetchNumeric( + 'SELECT CAST(? AS VARCHAR) AS a, CAST(? AS VARCHAR) AS b FROM SYSIBM.SYSDUMMY1', + $params, + [ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT], + ); + + self::assertEquals(['test1', 'test2'], $values); + } }