2.5 -> 2.6 upgrade BC break: added restrictions on aliases/identifiers #6176

Open
opened 2026-01-22 15:28:15 +01:00 by admin · 0 comments
Owner

Originally created by @zerocrates on GitHub (Feb 15, 2019).

BC Break Report

Q A
BC Break yes
Version any 2.6

Summary

DQL in 2.5 is very loose with what's allowed as an alias: in particular, my usage was to simply repeat the FQCN as the "alias" to avoid the distinction, and this works perfectly fine.

In 2.6 such aliases are syntax errors.

The 2.6 EBNF documentation was updated to indicate the new restriction, but I don't see mention of it elsewhere, in UPGRADING or otherwise.

Of course this would extend to other "interesting" aliases but in my particular case they're always FQCNs.

Current behavior

Given previously-working DQL of the form SELECT Example\Entity FROM Example\Entity Example\Entity ...:

[Syntax Error] line 0, col 7: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialObjectExpression | "(" Subselect ")" | CaseExpression, got 'Example\Entity'

Originally created by @zerocrates on GitHub (Feb 15, 2019). <!-- Before reporting a BC break, please consult the upgrading document to make sure it's not an expected change: https://github.com/doctrine/orm/blob/master/UPGRADE.md --> ### BC Break Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | yes | Version | any 2.6 #### Summary <!-- Provide a summary describing the problem you are experiencing. --> DQL in 2.5 is very loose with what's allowed as an alias: in particular, my usage was to simply repeat the FQCN as the "alias" to avoid the distinction, and this works perfectly fine. In 2.6 such aliases are syntax errors. The 2.6 EBNF documentation was [updated](https://github.com/doctrine/orm/commit/b7bd42638dcf8aa049698f01466688ff7762953b#diff-7c3c9fc075055354b2833bdadad669beR1412) to indicate the new restriction, but I don't see mention of it elsewhere, in UPGRADING or otherwise. Of course this would extend to other "interesting" aliases but in my particular case they're always FQCNs. #### Current behavior <!-- What is the current (broken) behavior? --> Given previously-working DQL of the form `SELECT Example\Entity FROM Example\Entity Example\Entity ...`: > [Syntax Error] line 0, col 7: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialObjectExpression | "(" Subselect ")" | CaseExpression, got 'Example\Entity'
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6176