We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
doctrine/orm tries to log a null value via the DBAL logger when using \Doctrine\ORM\Query@getSingleResult() after upgrading from 2.16.3 to 2.17.1
doctrine/orm tries to log a null value via the DBAL logger when using \Doctrine\ORM\Query@getSingleResult()
This is the error trace:
{ "type": "https://tools.ietf.org/html/rfc2616#section-10", "title": "An error occurred", "status": 500, "detail": "Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger::log(): Argument #1 ($message) must be of type string, null given, called in /var/www/vendor/symfony/doctrine-bridge/Logger/DbalLogger.php on line 43", "class": "TypeError", "trace": [ { "namespace": "", "short_class": "", "class": "", "type": "", "function": "", "file": "/var/www/vendor/symfony/doctrine-bridge/Logger/DbalLogger.php", "line": 58, "args": [] }, { "namespace": "Symfony\\Bridge\\Doctrine\\Logger", "short_class": "DbalLogger", "class": "Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger", "type": "->", "function": "log", "file": "/var/www/vendor/symfony/doctrine-bridge/Logger/DbalLogger.php", "line": 43, "args": [] }, { "namespace": "Symfony\\Bridge\\Doctrine\\Logger", "short_class": "DbalLogger", "class": "Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger", "type": "->", "function": "startQuery", "file": "/var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php", "line": 47, "args": [] }, { "namespace": "Doctrine\\DBAL\\Logging", "short_class": "LoggerChain", "class": "Doctrine\\DBAL\\Logging\\LoggerChain", "type": "->", "function": "startQuery", "file": "/var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php", "line": 1294, "args": [] }, { "namespace": "Doctrine\\DBAL", "short_class": "Connection", "class": "Doctrine\\DBAL\\Connection", "type": "->", "function": "executeQuery", "file": "/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php", "line": 33, "args": [] }, { "namespace": "Doctrine\\ORM\\Query\\Exec", "short_class": "SingleSelectExecutor", "class": "Doctrine\\ORM\\Query\\Exec\\SingleSelectExecutor", "type": "->", "function": "execute", "file": "/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php", "line": 327, "args": [] }, { "namespace": "Doctrine\\ORM", "short_class": "Query", "class": "Doctrine\\ORM\\Query", "type": "->", "function": "_doExecute", "file": "/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php", "line": 1212, "args": [] }, { "namespace": "Doctrine\\ORM", "short_class": "AbstractQuery", "class": "Doctrine\\ORM\\AbstractQuery", "type": "->", "function": "executeIgnoreQueryCache", "file": "/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php", "line": 1166, "args": [] }, { "namespace": "Doctrine\\ORM", "short_class": "AbstractQuery", "class": "Doctrine\\ORM\\AbstractQuery", "type": "->", "function": "execute", "file": "/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php", "line": 991, "args": [] }, { "namespace": "Doctrine\\ORM", "short_class": "AbstractQuery", "class": "Doctrine\\ORM\\AbstractQuery", "type": "->", "function": "getSingleResult", "file": "MY PROJECT FILE THAT USES \\Doctrine\\ORM\\Query@getSingleResult()", "line": 66, "args": [] } ]
This is the class that triggers the error (names have been modified)
<?php use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; class FooRepository { /** * @param EntityRepository<Foo> $doctrineFooRepository */ public function __construct( private readonly EntityManagerInterface $entityManager, private readonly EntityRepository $doctrineFooRepository ) { } public function getOneByBar(Bar $bar): Foo { $qb = $this->doctrineFooRepository->createQueryBuilder('i'); $qb->join( // ) ->setParameter('bar', $bar) ; $query = $qb->getQuery(); try { $result = $query->getSingleResult(); // ERROR HAPPENS HERE } catch (\Throwable $e) { throw new FooNotFound($e); } return $result; } public function find(string $id): ?Foo { $foo = $this->doctrineFooRepository->find($id); return $foo instanceof Foo ? $foo : null; } public function add(Foo $foo): void { $this->entityManager->persist($foo); $this->entityManager->flush(); } }
doctrine/orm should not try to log a NULL value since the logger expects string values.
The text was updated successfully, but these errors were encountered:
This looks related to https://github.com/doctrine/orm/pull/11027… what query cache do you use? Do you reproduce this on your development environment?
Sorry, something went wrong.
No branches or pull requests
Bug Report
Summary
doctrine/orm tries to log a null value via the DBAL logger when using \Doctrine\ORM\Query@getSingleResult() after upgrading from 2.16.3 to 2.17.1
Current behavior
doctrine/orm tries to log a null value via the DBAL logger when using \Doctrine\ORM\Query@getSingleResult()
This is the error trace:
How to reproduce
This is the class that triggers the error (names have been modified)
Expected behavior
doctrine/orm should not try to log a NULL value since the logger expects string values.
The text was updated successfully, but these errors were encountered: