-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Use !isset for checks cause this doesn't falsely include 0 #41000
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
Can you add a test for this issue? Question: |
Excellent PR. Thank you. If you add a small test for this I'll be happy to merge. |
I'm kinda waiting on a reply in the mentioned issue tbh. |
Sorry took me a while to get to it but I got some tests that would fail without the changes on both PRs |
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
Outdated
Show resolved
Hide resolved
This applies to |
Yeah it's actually a thing in all symfony versions I think. |
@@ -170,9 +170,9 @@ public function reverseTransform($value) | |||
empty($value['year']) ? $this->referenceDate->format('Y') : $value['year'], | |||
empty($value['month']) ? $this->referenceDate->format('m') : $value['month'], | |||
empty($value['day']) ? $this->referenceDate->format('d') : $value['day'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please ensure we have a test case using 0
for year+month+day?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it as test for DateType.
Thank you @KDederichs. |
By using isset 0 won't falsely included anymore