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

[Validator] Fixed the @Valid(groups={"group"}) against null exception case #25297

Merged
merged 1 commit into from Dec 4, 2017

Conversation

vudaltsov
Copy link
Contributor

@vudaltsov vudaltsov commented Dec 3, 2017

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

When @Valid(groups={"group"}) has non-empty groups and the value is null, validator throws Cannot validate values of type "NULL" automatically. Please provide a constraint. at RecursiveContextualValidator:164.

I don't really understand, why everything is okay for @Valid() without groups, but hope that my fix is correct anyway.

Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@xabbuh xabbuh added this to the 3.4 milestone Dec 4, 2017
@nicolas-grekas
Copy link
Member

Thank you @vudaltsov.

@nicolas-grekas nicolas-grekas merged commit 56f24d0 into symfony:3.4 Dec 4, 2017
nicolas-grekas added a commit that referenced this pull request Dec 4, 2017
…l exception case (vudaltsov)

This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Fixed the @Valid(groups={"group"}) against null exception case

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

When `@Valid(groups={"group"})` has non-empty groups and the value is `null`, validator throws `Cannot validate values of type "NULL" automatically. Please provide a constraint.` at `RecursiveContextualValidator:164`.

I don't really understand, why everything is okay for `@Valid()` without groups, but hope that my fix is correct anyway.

Commits
-------

56f24d0 Fixed the null value exception case.
@vudaltsov vudaltsov deleted the valid-null branch December 4, 2017 12:19
This was referenced Dec 4, 2017
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

5 participants