mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
2.18.x: Lexer not longer implementing ArrayAccess #7305
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 @alexander-schranz on GitHub (Jan 28, 2024).
BC Break Report
Summary
Theoro/doctrine-extensionsis using theDoctrine\ORM\Query\Lexer, with adding support fordoctrine/lexerversion 3 in 2.18 of doctrine/orm theDoctrine\ORM\Query\Lexernot longer implements the ArrayAccess which leads to an unexpected error.Update: its the
Tokenclass which is not longer implementing the ArrayAccess. Maybe we need to make sure that all doctrine extensions require the correct supported lexer version before we release 2.18.0. So no changes maybe require to fix this issue in orm package.Previous behavior
ArrayAccess was implemented byDoctrine\ORM\Query\Lexerover thedoctrine/lexer:2package.doctrine/lexer:2was installed which Token implemented the ArrayAccess.Current behavior
ArrayAccess is not longer implemented which ends in:
How to reproduce
Using GroupConcat of oro/doctrine-extensions. As they never directly u se the
doctrine/lexernamespace just thedoctrine/ormnamespace it is unexpected that in the minor jump the Orm/Lexer not longer shipped with ArrayAccess. So we maybe need to implement the ArrayAccess for thedoctrine/ormLexer and remove it then in doctrine/orm 3 to avoid this bc break.@greg0ire commented on GitHub (Jan 28, 2024):
Ah yes, that seems fair. In https://github.com/doctrine/orm/pull/11180#issuecomment-1903364350, @derrabus was wondering why didn't allow
doctrine/lexer3 sooner. This must be the answer. That being said, I don't think how you could implementArrayAccessindoctrine/orm2. There is no class to implement it on, as we use thedoctrine/lexerToken class directly. I think we should probably revert.@greg0ire commented on GitHub (Jan 28, 2024):
@alexander-schranz actually, I'm not sure we should revert. I think the crash is happening here, correct: https://github.com/oroinc/doctrine-extensions/blob/2.0.3/src/Oro/ORM/Query/AST/Functions/String/GroupConcat.php#L46 ?
The class in
doctrine/ormis not the one exposing thelookaheadproperty. The class doing that isDoctrine\Common\Lexer\AbstractLexer. This probably meansoro/doctrine-extensionsshould indeed specify a version constraint fordoctrine/lexer.@alexander-schranz commented on GitHub (Jan 28, 2024):
I did a PR on the oro extensions, https://github.com/oroinc/doctrine-extensions/pull/96. But think I need to also increase the required version for orm and dbal as doctrine/lexer did not exist always on older orm versions.
@alexander-schranz commented on GitHub (Jan 29, 2024):
Same problem found for: https://github.com/martin-georgiev/postgresql-for-doctrine/pull/177 and here alrey PR exists https://github.com/ScientaNL/DoctrineJsonFunctions/pull/95
@greg0ire commented on GitHub (Jan 29, 2024):
To clarify a bit further why we might have not allowed
doctrine/lexer3 before, I think we probably thought best to give a chance to everyone to notice the deprecations, since they are more helpful. In the end, it's still good to allow Lexer 3 on ORM 2, because it allows everyone to do the upgrade to ORM more progressively: they can upgrade to Lexer 3, deploy, and then upgrade to ORM 3 separately. It's a smaller upgrade.@alexander-schranz commented on GitHub (Feb 5, 2024):
I think we can close this one as it is not an issue on the doctrine side as the other packages need to define there dependencies here deeper.