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

PropertyPath cannot parse escaped property paths for arrays (first element wrapped in square brackets) #52884

Open
gnutix opened this issue Dec 4, 2023 · 2 comments

Comments

@gnutix
Copy link
Contributor

gnutix commented Dec 4, 2023

Symfony version(s) affected

v6.3.0-BETA1

Description

#49331 allowed to escape [ and . from PropertyPath strings, but the test suite was incomplete, and mostly covers the objects syntax (like foo.bar) and not so much the array syntax (like [foo][bar]). The author (@alanpoulain) mentioned :

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

So maybe that was intentional ? Still, I don't think this bug can be considered as an edge-case...

How to reproduce

<?php
new PropertyPath('[foo \[bar]][baz \. biz]');

throws an Exception :

Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException^ {#2696
  #message: "Could not parse property path "[foo \[bar]][baz \. biz]". Unexpected token "]" at position 11."
  #code: 0
  #file: "./vendor/symfony/property-access/PropertyPath.php"
  #line: 129
  trace: {
    ./vendor/symfony/property-access/PropertyPath.php:129 { …}
    ./var/script.php:52 {
      › 
      › dd(new PropertyPath('[foo \[bar]][baz \. biz]'));
      › 
      arguments: {
        $propertyPath: "[foo \[bar]][baz \. biz]"
      }
    }
  }
}

Possible Solution

No response

Additional Context

No response

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@gnutix
Copy link
Contributor Author

gnutix commented Jun 5, 2024

It is AFAIK

@carsonbot carsonbot removed the Stalled label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants