Skip to content

Support using null-safe operator with null value #55175

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

Merged

Conversation

willrowe
Copy link
Contributor

@willrowe willrowe commented Mar 26, 2025

This fixes the case when the MySQL null-safe operator <=> is used in a where condition with a RHS value of null. While the null-safe operator is already considered a valid operator, it is not currently considered valid by invalidOperatorAndValue when combined with a null value. This PR marks the combination as valid and expands the null convenience shortcut to convert it to is null/is not null .

I came across this when doing a comparison of a nullable column to a variable input which could also be null. I ended up using the null-safe operator so that the comparison would work as expected when the null values are encountered, since all other operators (=, !=, <>) return null instead of 0/1 when either side of the comparison is null.

Verified

This commit was signed with the committer’s verified signature.
Zhenay Evgeny Seregin
@taylorotwell taylorotwell merged commit a9d8775 into laravel:12.x Mar 27, 2025
41 checks passed
@willrowe willrowe deleted the feature/convert-null-safe-operator branch March 27, 2025 17:13
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