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

since symfony 5, Length with min option allows empty string #644

Merged
merged 1 commit into from Aug 17, 2022

Conversation

dbu
Copy link
Contributor

@dbu dbu commented Aug 11, 2022

while hunting a symfony 4 deprecation notice (yeah, i know we need to update that system), i realized that the min length validation will always allow empty string since symfony 5.

for symfony 5, we could set allowEmptyString to false, but in symfony 6 that option has been completely removed. the correct way to do it is to additionally assert that it is not blank.

from my understanding of json schema, a min length > 0 implies that the string may not be blank.

@dbu
Copy link
Contributor Author

dbu commented Aug 11, 2022

i will adjust test expections and add a test if necessary, but first wanted to check if my thinking is correct and if this is the right way to do things.

@dbu
Copy link
Contributor Author

dbu commented Aug 16, 2022

i now use the correct ::class constant for NotBlank and have adjusted the tests and fixtures. locally the tests are now green.

@Korbeil Korbeil merged commit 4a65d99 into janephp:next Aug 17, 2022
@Korbeil
Copy link
Member

Korbeil commented Aug 17, 2022

Thanks for contributing @dbu !

@dbu dbu deleted the fix-min-length branch September 29, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants