Closed
Description
Symfony version(s) affected
>= 5.4
Description
Hello there,
I just upgraded my application today (I switched from doctrine bundle 2.6.3 to 2.7.0) which is in 6.1 and my tests detected something weird.
Here is a part of the stack trace :
Behat\Testwork\Call\Exception\FatalThrowableError: Type error: Symfony\Bridge\Doctrine\Middleware\Debug\Query::setValue(): Argument #2 ($value) must be of type string|int|float|bool|null, resource given, called in vendor/symfony/doctrine-bridge/Middleware/Debug/Statement.php on line 48 in vendor/symfony/doctrine-bridge/Middleware/Debug/Query.php:55
Stack trace:
#0 vendor/symfony/doctrine-bridge/Middleware/Debug/Statement.php(48): Symfony\Bridge\Doctrine\Middleware\Debug\Query->setValue(5, Resource id #2538, 16)
#1 vendor/doctrine/dbal/src/Statement.php(115): Symfony\Bridge\Doctrine\Middleware\Debug\Statement->bindValue(5, Resource id #2538, 16)
#2 vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(274): Doctrine\DBAL\Statement->bindValue(5, Resource id #2538, Object(Doctrine\DBAL\Types\BinaryType))
#3 vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1129): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->executeInserts()
#4 vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(426): Doctrine\ORM\UnitOfWork->executeInserts(Object(Doctrine\ORM\Mapping\ClassMetadata))
#5 vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(398): Doctrine\ORM\UnitOfWork->commit(NULL)
#6 var/cache/test/ContainerZdJq7y7/EntityManager_9a5be93.php(136): Doctrine\ORM\EntityManager->flush(NULL)
#7 src/Services/NetworkIpv6Manager.php(163): ContainerZdJq7y7\EntityManager_9a5be93->flush()
#8 src/Controller/Ipv6Controller.php(136): App\Services\NetworkIpv6Manager->splitIpv6Subnet(Object(App\Entity\ConfNetworkclass), '2001:bc8:3000:1...')
After digging a bit, I realized that this commit introduced a change in the query loggers (dbal logger -> middleware) which is the starting point of the issue. Indeed, it looks like the Query
class does not handle binary values so that's why we end up with a fatal error.
How to reproduce
Create an entity with a field of 'binary' type (I guess it would work for blob values as well) ... pushing further the thought I'm even wondering if the DateTime would be handled correctly but I'm far from being an expert on this one 🤔
Possible Solution
No response
Additional Context
No response