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

[Form] do not apply the Valid constraint on scalar form data #39333

Merged
merged 2 commits into from Dec 5, 2020

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Dec 5, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #38039
License MIT
Doc PR

#SymfonyHackday

@fabpot
Copy link
Member

fabpot commented Dec 5, 2020

Thank you @xabbuh.

@fabpot fabpot merged commit 21ef411 into symfony:4.4 Dec 5, 2020
@xabbuh xabbuh deleted the issue-38039 branch December 5, 2020 16:40
This was referenced Dec 18, 2020
stof added a commit that referenced this pull request Mar 11, 2022
…ed forms (stof)

This PR was merged into the 4.4 branch.

Discussion
----------

[Form] Fix the usage of the Valid constraints in array-based forms

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

This is a bug introduced in #39333. When wanting to exclude scalar forms, it also excluded array forms.
The code now uses the same `\is_object($data) || \is_array($data)` condition for `Valid` constraint than the condition it uses as part of the `$validateDataGraph` condition.

The new tests reflects my own use case: an unmapped collection field, were we want to run the validation on that subtree (which is not traversed for other reasons due to being unmapped, and so we need `Valid`). This was working fine in older versions of Symfony, but the validation was silently skipped in 4.4.18+.

Commits
-------

542c2fb Fix the usage of the Valid constraints in array-based forms
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.

None yet

4 participants