-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] GroupSequence stopping at first group, never using the second #36852
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
Comments
Thank you for the great example. I can reproduce it and I am working on a fix for it. |
WIP PR is here: #36865 @damienalexandre Your use case should already be fixed by the current state of the PR, but I need to do some more adaptions. |
@damienalexandre Can you confirm that #36865 fixes your issue (it should be ready now)? |
Hello @xabbuh I applied your patch on our project, and unfortunately, this is worst.
The faulty line: foreach ($form->all() as $field) {
if ($field->isSubmitted()) {
$this->resolvedGroups[$field] = $groups; // line 133
$fieldFormConstraint = new Form();
$validator->atPath(sprintf($fieldPropertyPath, $field->getPropertyPath()))->validate($field, $fieldFormConstraint);
}
} |
@lyrixx Can you extract a failing test case? |
Hello @xabbuh I took time to dig it. I also managed to create a reproducer. Actually, it's super easy : 2 fields... I guess there is an issue with "deepness" 'I guess because of Anyway, here is the reproducer : Thanks for taking time to dig in this issue, I don't know so much about this component :/ |
@lyrixx Thanks, I am going to look into it tomorrow. |
This PR was merged into the 3.4 branch. Discussion ---------- [Form] validate subforms in all validation groups | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #36852 | License | MIT | Doc PR | Commits ------- b819d94 validate subforms in all validation groups
Symfony version(s) affected: v3.4.40
Description
I'm using Symfony v3.4.37 and tried to upgrade to v3.4.40, but it looks like the GroupSequence validation_groups is not working as expected anymore.
How to reproduce
Here is a simple test to reproduce:
The first one use two groups, the form is not valid which is what we expect.
The second test use the sames groups in a GroupSequence, this is where I see a difference between Symfony version:
Possible Solution
None.
Additional context
Tested on (yes, I know 😬):
The text was updated successfully, but these errors were encountered: