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] fix comparisons with null values at property paths #29839

Open
wants to merge 1 commit into
base: 3.4
from

Conversation

Projects
None yet
2 participants
@xabbuh
Copy link
Member

xabbuh commented Jan 10, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #29831
License MIT
Doc PR
@@ -24,7 +24,7 @@ class GreaterThanOrEqualValidator extends AbstractComparisonValidator
*/
protected function compareValues($value1, $value2)
{
return $value1 >= $value2;
return null !== $value2 && $value1 >= $value2;

This comment has been minimized.

@sgehrig

sgehrig Jan 11, 2019

Contributor
Suggested change Beta
return null !== $value2 && $value1 >= $value2;
return null === $value2 || $value1 >= $value2;
@@ -24,7 +24,7 @@ class GreaterThanValidator extends AbstractComparisonValidator
*/
protected function compareValues($value1, $value2)
{
return $value1 > $value2;
return null !== $value2 && $value1 > $value2;

This comment has been minimized.

@sgehrig

sgehrig Jan 11, 2019

Contributor
Suggested change Beta
return null !== $value2 && $value1 > $value2;
return null === $value2 || $value1 > $value2;
@@ -24,7 +24,7 @@ class LessThanOrEqualValidator extends AbstractComparisonValidator
*/
protected function compareValues($value1, $value2)
{
return $value1 <= $value2;
return null !== $value2 && $value1 <= $value2;

This comment has been minimized.

@sgehrig

sgehrig Jan 11, 2019

Contributor
Suggested change Beta
return null !== $value2 && $value1 <= $value2;
return null === $value2 || $value1 <= $value2;
@@ -24,7 +24,7 @@ class LessThanValidator extends AbstractComparisonValidator
*/
protected function compareValues($value1, $value2)
{
return $value1 < $value2;
return null !== $value2 && $value1 < $value2;

This comment has been minimized.

@sgehrig

sgehrig Jan 11, 2019

Contributor
Suggested change Beta
return null !== $value2 && $value1 < $value2;
return null === $value2 || $value1 < $value2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment