Skip to content

[Form] [Validator] When using group sequences on a form, sometimes constraints are ignored even though they should fail. #38300

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

Conversation

johanderuijter
Copy link

Q A
Branch? 4.4
Bug fix? yes/no
New feature? no
Deprecations? no
License MIT

Symfony version(s) affected: >= 4.4.10

Description
When using group sequences on a form, sometimes constraints are ignored even though they should fail. This appears to happen where there is a field with multiple constraints added with a group sequence and also an additional field that does not have any constraints whatsoever. It appears to matter whether the additional field is added before or after the field with the constraints that have a sequence.

My initial case was a much more complicated form, but this seems to be the root of the problem.

So far, i only have a failing test case. It is a copy of the test above with only one change: an additional field above the field that was already there.

  • write actual fix

Because i had a failing test case, i decided to create a PR, but if you'd rather i make an issue, i can close this and do that instead.

… issue

When using group sequences on a form, sometimes constraints are ignored even though they should fail.
@johanderuijter johanderuijter force-pushed the group-sequence-ignores-some-constraints branch from 144d1c0 to 814f790 Compare September 25, 2020 14:01
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Sep 27, 2020
@xabbuh
Copy link
Member

xabbuh commented Oct 2, 2020

Thank you @johanderuijter for this great test case. This was really helpful to identify the root cause. I have proposed a fix for this in #38380. Can you verify if this also fixes your more complex real use case?

@xabbuh
Copy link
Member

xabbuh commented Oct 2, 2020

By the way, let's close here in favor of the other PR.

@xabbuh xabbuh closed this Oct 2, 2020
nicolas-grekas added a commit that referenced this pull request Oct 2, 2020
…jter, xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] propagate validation groups to subforms

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38300
| License       | MIT
| Doc PR        |

Commits
-------

04f5698 propagate validation groups to subforms
e2c7c33 [Form] [Validator] Add failing testcase to demonstrate group sequence issue
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.

5 participants