mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1095: Selecting Literals will not work, crashing bug #1371
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 2, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user dalvarez:
DQL queries selecting String literals like
SELECT '' FROM \Whatever
(empty string) will result in a DQL Parsing error.
DQL queries selecting numeric literals like
SELECT 0 FROM \Whatever
will crash Doctrine 2:
I won't go into the details of how the EBNF definition claims this is possible, because it is quite obvious. Basically, you should be able to select a Literal anywhere a scalar expression is expected. That this is not actually possible sucks, because sometimes it is handy to be able to include placeholder values in generated queries.
Warning: Illegal offset type in /Doctrine/ORM/Query/SqlWalker.php on line 988 Warning: Illegal offset type in isset or empty in /Doctrine/ORM/Query/SqlWalker.php on line 991 Warning: Illegal offset type in /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/SqlWalker.php on line 992 Notice: Trying to get property of non-object in /Doctrine/ORM/Query/SqlWalker.php on line 997 Warning: Invalid argument supplied for foreach() in /Doctrine/ORM/Query/SqlWalker.php on line 997 Fatal error: Call to a member function isInheritanceTypeSingleTable() on a non-object in /Doctrine/ORM/Query/SqlWalker.php on line 1023
The line numbers in the error message might be different from a vanilla 2.02 release, because I have patched the SQLWalker to include support for multiple FROM clause entries in combination with multiple explicit joins (http://www.doctrine-project.org/jira/browse/DDC-1047).
Here is the code snippet where Doctrine 2 crashes, for your convenience. This should not be affected by the local changes:
@doctrinebot commented on GitHub (Apr 2, 2011):
@doctrinebot commented on GitHub (Apr 2, 2011):
Comment created by @beberlei:
Are you using the bugfix patch for DDC-1077 also? This fixes the issue for me. DDC-1077 will be included in 2.0.3 which will be released tomorrow.
Does the crash happen in a subselect?
@doctrinebot commented on GitHub (Apr 2, 2011):
Comment created by dalvarez:
Apart from the changes regarding DDC-1047 my installation is a vanilla 2.0.2.
The crash happens in a top-level query. In the select expression, regular entity fields get queried, too. I tried to select a literal to pad the query result to a common format, but the change made it crash. After removing the literal (replacing it with some random reference to a regular entity field) it worked again.
@doctrinebot commented on GitHub (Apr 2, 2011):
Comment created by dalvarez:
No, wait. It is a 2.0.3. I think you mean 2.0.4 will be released tomorrow.
@doctrinebot commented on GitHub (Apr 2, 2011):
Comment created by dalvarez:
I think the string literal problem is precisely the same issue as DDC-1077. If the fix also covers numeric literals, this can be closed as fixed. According to your unit test above, numeric literals should be covered.
@doctrinebot commented on GitHub (Apr 3, 2011):
Comment created by @beberlei:
Duplicate of DDC-1077
@doctrinebot commented on GitHub (Apr 3, 2011):
Issue was closed with resolution "Duplicate"