Doctrine\DBAL\Driver\Exception\UnknownParameterType: Unknown parameter type, 105 given. #7151

Open
opened 2026-01-22 15:45:37 +01:00 by admin · 9 comments
Owner

Originally created by @brian-n-millar on GitHub (May 8, 2023).

Bug Report

Q A
Version DBAL 3.6.2, ORM 2.14.3

Summary

When using findBy method I am using an array of values to check for which previously worked but now gives this error.

The code is basically as follows (I've altered it a bit for posting here):

$er = $this->em->getRepository('User\Entity\User');
$collection = $er->findBy(['state' => 0, 'deleted' => [null, 0]], ['firstname' => 'ASC']);

The issue comes from deleted column, it is a boolean type in the DB, here I want to check if it is either NULL or 0 (false in MySQL).
This did work fine previously, now I am getting the error in the title.
I traced it through and traced down to this in file doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php in function getTypes on line 1960:

if (is_array($value)) {
    return array_map(static function ($type) {
        $type = Type::getType($type);

        return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET;
    }, $types);
}

It checks if the value is an array which it is, then gets the type of the column with is Boolean which resolves to integer 5 then adds this ARRAY_PARAM_OFFSET which adds integer 100 to the value resulting in 105 as the parameter type whereas others resolve to a string like "integer". This leads to the failure as later code doesn't understand this 105 type.

Am I doing something wrong? Is this way of using an array in a findBy deprecated or something?

Originally created by @brian-n-millar on GitHub (May 8, 2023). ### Bug Report | Q | A |------------ | ------ | Version | DBAL 3.6.2, ORM 2.14.3 #### Summary When using findBy method I am using an array of values to check for which previously worked but now gives this error. The code is basically as follows (I've altered it a bit for posting here): ```php $er = $this->em->getRepository('User\Entity\User'); $collection = $er->findBy(['state' => 0, 'deleted' => [null, 0]], ['firstname' => 'ASC']); ``` The issue comes from `deleted` column, it is a boolean type in the DB, here I want to check if it is either `NULL` or `0` (false in MySQL). This did work fine previously, now I am getting the error in the title. I traced it through and traced down to this in file `doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php` in function `getTypes` on line `1960`: ```php if (is_array($value)) { return array_map(static function ($type) { $type = Type::getType($type); return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET; }, $types); } ``` It checks if the value is an array which it is, then gets the type of the column with is Boolean which resolves to integer `5` then adds this `ARRAY_PARAM_OFFSET` which adds integer `100` to the value resulting in `105` as the parameter type whereas others resolve to a string like "integer". This leads to the failure as later code doesn't understand this `105` type. Am I doing something wrong? Is this way of using an array in a findBy deprecated or something?
admin added the Bug label 2026-01-22 15:45:37 +01:00
Author
Owner

@derrabus commented on GitHub (May 8, 2023):

Thanks for this thorough analysis. To me, this looks like the issue is on the ORM's side, so we should transfer the issue there. Can you tell us which ORM version you're using?

@derrabus commented on GitHub (May 8, 2023): Thanks for this thorough analysis. To me, this looks like the issue is on the ORM's side, so we should transfer the issue there. Can you tell us which ORM version you're using?
Author
Owner

@brian-n-millar commented on GitHub (May 8, 2023):

doctrine/orm 2.14.3 and I'm using doctrine-orm-module 5.3.0 with Laminas

@brian-n-millar commented on GitHub (May 8, 2023): doctrine/orm 2.14.3 and I'm using doctrine-orm-module 5.3.0 with Laminas
Author
Owner

@brian-n-millar commented on GitHub (Jul 4, 2023):

Any update?

@brian-n-millar commented on GitHub (Jul 4, 2023): Any update?
Author
Owner

@derrabus commented on GitHub (Jul 5, 2023):

Not from my side. Feel free to work on a fix.

@derrabus commented on GitHub (Jul 5, 2023): Not from my side. Feel free to work on a fix.
Author
Owner

@Quiesss commented on GitHub (Nov 1, 2023):

up

@Quiesss commented on GitHub (Nov 1, 2023): up
Author
Owner

@bystro commented on GitHub (Nov 27, 2023):

Q A
Version DBAL 3.7.2, ORM 2.17.1

I think I have the same issue when switch to EAGER fetch mode for a ManytoOne relation
* @ORM\ManyToOne(targetEntity="App\Area\Entity\Area", fetch="EAGER")
or
$qb->getQuery()->setFetchMode(Place::class, "area", ClassMetadataInfo::FETCH_EAGER)

[Doctrine\DBAL\Exception\DriverException] An exception occurred while executing a query: Unknown parameter type, 105 given.
doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117


In ExceptionConverter.php line 117:

[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing a query: Unknown parameter type, 105 given.

Exception trace:
at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117
Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1938
Doctrine\DBAL\Connection->handleDriverException() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1880
Doctrine\DBAL\Connection->convertExceptionDuringQuery() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1105
Doctrine\DBAL\Connection->executeQuery() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:939
Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3147
Doctrine\ORM\UnitOfWork->triggerEagerLoads() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php:126
Doctrine\ORM\Internal\Hydration\ObjectHydrator->cleanup() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:272
Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1225
Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1166
Doctrine\ORM\AbstractQuery->execute() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:991

In UnknownParameterType.php line 21:

[Doctrine\DBAL\Driver\Exception\UnknownParameterType]
Unknown parameter type, 105 given.

Exception trace:
at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php:21
Doctrine\DBAL\Driver\Exception\UnknownParameterType::new() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php:36
Doctrine\DBAL\Driver\PDO\ParameterTypeMap::convertParamType() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:45
Doctrine\DBAL\Driver\PDO\Statement->bindValue() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1804
Doctrine\DBAL\Connection->bindParameters() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1096
Doctrine\DBAL\Connection->executeQuery() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:939
Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3147
Doctrine\ORM\UnitOfWork->triggerEagerLoads() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php:126
Doctrine\ORM\Internal\Hydration\ObjectHydrator->cleanup() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:272
Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1225
Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1166
Doctrine\ORM\AbstractQuery->execute() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:991

@bystro commented on GitHub (Nov 27, 2023): Q | A -- | -- Version | DBAL 3.7.2, ORM 2.17.1 I think I have the same issue when switch to EAGER fetch mode for a `ManytoOne` relation `* @ORM\ManyToOne(targetEntity="App\Area\Entity\Area", fetch="EAGER")` or `$qb->getQuery()->setFetchMode(Place::class, "area", ClassMetadataInfo::FETCH_EAGER)` `[Doctrine\DBAL\Exception\DriverException] An exception occurred while executing a query: Unknown parameter type, 105 given.` doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117 --- > In ExceptionConverter.php line 117: [Doctrine\DBAL\Exception\DriverException] An exception occurred while executing a query: Unknown parameter type, 105 given. Exception trace: at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117 Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1938 Doctrine\DBAL\Connection->handleDriverException() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1880 Doctrine\DBAL\Connection->convertExceptionDuringQuery() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1105 Doctrine\DBAL\Connection->executeQuery() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:939 Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3147 Doctrine\ORM\UnitOfWork->triggerEagerLoads() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php:126 Doctrine\ORM\Internal\Hydration\ObjectHydrator->cleanup() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:272 Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1225 Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1166 Doctrine\ORM\AbstractQuery->execute() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:991 In UnknownParameterType.php line 21: [Doctrine\DBAL\Driver\Exception\UnknownParameterType] Unknown parameter type, 105 given. Exception trace: at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php:21 Doctrine\DBAL\Driver\Exception\UnknownParameterType::new() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php:36 Doctrine\DBAL\Driver\PDO\ParameterTypeMap::convertParamType() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:45 Doctrine\DBAL\Driver\PDO\Statement->bindValue() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1804 Doctrine\DBAL\Connection->bindParameters() at /var/www/html/modern-content-parser/vendor/doctrine/dbal/src/Connection.php:1096 Doctrine\DBAL\Connection->executeQuery() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:939 Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3147 Doctrine\ORM\UnitOfWork->triggerEagerLoads() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php:126 Doctrine\ORM\Internal\Hydration\ObjectHydrator->cleanup() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:272 Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1225 Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:1166 Doctrine\ORM\AbstractQuery->execute() at /var/www/html/modern-content-parser/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:991
Author
Owner

@derrabus commented on GitHub (Nov 27, 2023):

Do you want to investigate the issue or work on a fix? If not, a reproducer or even a full stack trace would be helpful for anyone who wants to contribute a fix.

@derrabus commented on GitHub (Nov 27, 2023): Do you want to investigate the issue or work on a fix? If not, a reproducer or even a full stack trace would be helpful for anyone who wants to contribute a fix.
Author
Owner

@bystro commented on GitHub (Nov 27, 2023):

The issue was with a boolean type on PRIMARY KEY. It works when changed to integer

* @ORM\Column(name="id", type="integer", nullable=false)

@bystro commented on GitHub (Nov 27, 2023): The issue was with a `boolean` type on PRIMARY KEY. It works when changed to `integer` `* @ORM\Column(name="id", type="integer", nullable=false)`
Author
Owner

@derrabus commented on GitHub (Nov 30, 2023):

@derrabus why do you keep hoping a community member will just come along and fix this? Why is it not taken seriously by Doctrine team?

Since you're addressing me directly, I will try to answer your questions as politely as I'm able to.

The short answer is: The bug does neither affects me personally nor anyone who pays me for my work. Believe it or not, my day only has 24 hours like everyone else's. I have a day job and a family. So, my personal priorities are (in that order):

  • Work that people pay me for, which allows me to provide for my family.
  • Family chores.
  • Spending time with my kids.
  • Open source work that sparks joy, including helping contributors with getting their contributions merged.
  • Writing invoices, sorting receipts for my accountant, filing my tax reports.
  • A lot of other things.
  • Working for free on some random bug of one of the open source projects I help maintaining in my freaking freetime because some random jerk tells me I should take my unpaid job seriously.

This is a bug affecting production systems with detailed evidence shown by 2 users now and originally reported months ago.

Nobody's disputing the the existence of this bug.

I understand you are probably volunteers

Now, do you.

I appreciate the work open source devs do for free

Really.

but it doesn't inspire confidence in people/companies to use your project in production when they have a problem and your response is basically 'fix it yourself'.

Then, don't use it. Write and maintain your own ORM. Please. I have no intention to fix stuff for some freeloaders that complain about me not aligning my priorities with theirs.


So, if anyone wants to help getting this bug fixed, I'm happy to provide all the support I can.

@derrabus commented on GitHub (Nov 30, 2023): > @derrabus why do you keep hoping a community member will just come along and fix this? Why is it not taken seriously by Doctrine team? Since you're addressing me directly, I will try to answer your questions as politely as I'm able to. The short answer is: The bug does neither affects me personally nor anyone who pays me for my work. Believe it or not, my day only has 24 hours like everyone else's. I have a day job and a family. So, my personal priorities are (in that order): * Work that people pay me for, which allows me to provide for my family. * Family chores. * Spending time with my kids. * Open source work that sparks joy, including helping contributors with getting their contributions merged. * Writing invoices, sorting receipts for my accountant, filing my tax reports. * A lot of other things. * Working for free on some random bug of one of the open source projects I help maintaining in my freaking freetime because some random jerk tells me I should take my unpaid job seriously. > This is a bug affecting production systems with detailed evidence shown by 2 users now and originally reported months ago. Nobody's disputing the the existence of this bug. > I understand you are probably volunteers Now, do you. > I appreciate the work open source devs do for free Really. > but it doesn't inspire confidence in people/companies to use your project in production when they have a problem and your response is basically 'fix it yourself'. Then, don't use it. Write and maintain your own ORM. Please. I have no intention to fix stuff for some freeloaders that complain about me not aligning my priorities with theirs. --- So, if anyone wants to help getting this bug fixed, I'm happy to provide all the support I can.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7151