Call to a member function getSqlExecutor() on null with DQL of "0" #6383

Closed
opened 2026-01-22 15:32:09 +01:00 by admin · 1 comment
Owner

Originally created by @ntzm on GitHub (Jan 14, 2020).

Bug Report

Q A
BC Break no
Version 2.7.0

Summary

When executing a DQL query of "0", it throws a PHP fatal error

Current behavior

Fatal error: Uncaught Error: Call to a member function getSqlExecutor() on null in /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:298
Stack trace:
#0 /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(992): Doctrine\ORM\Query->_doExecute()
#1 /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(947): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, NULL)
#2 /home/nat/Code/personal/fuzzer-test/doctrine-dql/test.php(12): Doctrine\ORM\AbstractQuery->execute()
#3 {main}
  thrown in /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php on line 298

How to reproduce

<?php

require __DIR__ . '/vendor/autoload.php';

$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(['/empty'], true);
$em = \Doctrine\ORM\EntityManager::create([
    'driver' => 'pdo_sqlite',
], $config);

$em->createQuery('0')->execute();

Expected behavior

Parse error

Originally created by @ntzm on GitHub (Jan 14, 2020). ### Bug Report | Q | A |------------ | ------ | BC Break | no | Version | 2.7.0 #### Summary When executing a DQL query of "0", it throws a PHP fatal error #### Current behavior ``` Fatal error: Uncaught Error: Call to a member function getSqlExecutor() on null in /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:298 Stack trace: #0 /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(992): Doctrine\ORM\Query->_doExecute() #1 /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(947): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, NULL) #2 /home/nat/Code/personal/fuzzer-test/doctrine-dql/test.php(12): Doctrine\ORM\AbstractQuery->execute() #3 {main} thrown in /home/nat/Code/personal/fuzzer-test/doctrine-dql/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php on line 298 ``` #### How to reproduce ``` <?php require __DIR__ . '/vendor/autoload.php'; $config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(['/empty'], true); $em = \Doctrine\ORM\EntityManager::create([ 'driver' => 'pdo_sqlite', ], $config); $em->createQuery('0')->execute(); ``` #### Expected behavior Parse error
admin added the Bug label 2026-01-22 15:32:09 +01:00
admin closed this issue 2026-01-22 15:32:09 +01:00
Author
Owner

@beberlei commented on GitHub (Feb 15, 2020):

This is fixed in #7987

@beberlei commented on GitHub (Feb 15, 2020): This is fixed in #7987
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6383