Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ExpressionLanguage] #[Assert\Expression] validation fails with "Undefined array key" warning. #48706

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

Closed
ghost opened this issue Dec 19, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 19, 2022

Symfony version(s) affected

6.2.2

Description

When using the version 6.2.2 of symfony/expression-language the #[Assert\Expression] validation constraint is broken and validation always fails. The issue does appear only in production environment.

How to reproduce

  • Setup reproducer app:
git clone https://github.com/jbroutier/sf-expression-language-issue
cd sf-expression-language-issue
composer install
php -S 0.0.0.0:8080 -t public
  • Open browser and navigate to http://127.0.0.1:8080.
  • Fill the form and submit it, validation passes.
  • Fill the form again and submit it, validation fails. Removing the cache fixes the issue for another round.

Possible Solution

Likely caused by #48559. As a temporary workaround, reverting symfony/expression-language to version 6.2.0 fixes the issue.

Additional Context

PHP error log:
[Mon Dec 19 16:21:34 2022] PHP Warning: Undefined array key "nodes" in /usr/development/skeleton/vendor/symfony/expression-language/Node/GetAttrNode.php on line 158
[Mon Dec 19 16:21:34 2022] PHP Warning: Undefined array key "attributes" in /usr/development/skeleton/vendor/symfony/expression-language/Node/GetAttrNode.php on line 159
[Mon Dec 19 16:21:34 2022] PHP Warning: Undefined array key "nodes" in /usr/development/skeleton/vendor/symfony/expression-language/Node/GetAttrNode.php on line 158
[Mon Dec 19 16:21:34 2022] PHP Warning: Undefined array key "attributes" in /usr/development/skeleton/vendor/symfony/expression-language/Node/GetAttrNode.php on line 159
[Mon Dec 19 16:21:34 2022] PHP Warning: Undefined array key "type" in /usr/development/skeleton/vendor/symfony/expression-language/Node/GetAttrNode.php on line 70
[Mon Dec 19 16:21:34 2022] PHP Warning: Undefined array key "type" in /usr/development/skeleton/vendor/symfony/expression-language/Node/GetAttrNode.php on line 70

@fancyweb
Copy link
Contributor

Looking at it. Thanks for the reproducer.

nicolas-grekas added a commit that referenced this issue Dec 22, 2022
…ut not __serialize() (fancyweb)

This PR was merged into the 5.4 branch.

Discussion
----------

[VarExporter] Fix exporting classes with __unserialize() but not __serialize()

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #48706 indirectly
| License       | MIT
| Doc PR        | -

This is an edge case not supported yet, highlighted by our own symfony/expression-language GetAttrNode class.

Commits
-------

6ccb85e [VarExporter] Fix exporting classes with __unserialize() but not __serialize()
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