Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PropertyAccess] Allow escaping in PropertyPath #49331

Merged
merged 1 commit into from Feb 18, 2023

Conversation

alanpoulain
Copy link
Contributor

@alanpoulain alanpoulain commented Feb 10, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #41845
License MIT
Doc PR TODO symfony/symfony-docs#...

I'm not sure if it can be considered a feature or a fix.

Currently there is no way to escape . and [ when using PropertyPath.
It can cause issue when we want to access a "property" containing a dot (for instance a key in an array).

I tried to modify the regexp as little as possible and to handle (really) edge cases such as double escaping.

Initially I had the issue in some Behat tests where I needed to evaluate some paths in a big JSON file (OpenAPI documentation).
Some keys contain dots and I cannot test the JSON node when it's the case.

@carsonbot carsonbot added this to the 6.3 milestone Feb 10, 2023
@alanpoulain alanpoulain changed the title feat(property-access): allow escaping in PropertyPath [PropertyAccess] Allow escaping in PropertyPath Feb 10, 2023
@carsonbot carsonbot changed the title [PropertyAccess] Allow escaping in PropertyPath Allow escaping in PropertyPath Feb 14, 2023
@carsonbot carsonbot changed the title Allow escaping in PropertyPath [PropertyAccess] Allow escaping in PropertyPath Feb 14, 2023
@chalasr
Copy link
Member

chalasr commented Feb 18, 2023

Thank you @alanpoulain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect behavior of PropertyAccessor when dynamic property contains dot
5 participants