Skip to content

Commit 3bc1096

Browse files
committed
[GH-7982] Default Query state to dirty to fix execution of empty query.
1 parent a2f01f7 commit 3bc1096

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

lib/Doctrine/ORM/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ final class Query extends AbstractQuery
133133
*
134134
* @var integer
135135
*/
136-
private $_state = self::STATE_CLEAN;
136+
private $_state = self::STATE_DIRTY;
137137

138138
/**
139139
* A snapshot of the parameter types the query was parsed with.

tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ public function invalidDQL()
134134
['SELECT \'foo\' AS foo\\\\bar FROM Doctrine\Tests\Models\CMS\CmsUser u'],
135135
['SELECT \'foo\' AS foo: FROM Doctrine\Tests\Models\CMS\CmsUser u'],
136136
['SELECT \'foo\' AS foo:bar FROM Doctrine\Tests\Models\CMS\CmsUser u'],
137+
138+
['0'],
137139
];
138140
}
139141

tests/Doctrine/Tests/ORM/Query/QueryTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,13 @@ public function testValuesAreNotBeingResolvedForSpecifiedParameterTypes() : void
420420

421421
self::assertEmpty($query->getResult());
422422
}
423+
424+
/** @group 7982 */
425+
public function testNonExistentExecutor()
426+
{
427+
$this->expectException(QueryException::class);
428+
$this->expectExceptionMessage('[Syntax Error] line 0, col -1: Error: Expected SELECT, UPDATE or DELETE, got end of string.');
429+
430+
$query = $this->_em->createQuery('0')->execute();
431+
}
423432
}

0 commit comments

Comments
 (0)