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

[10.x] Fix whereNull queries with raw expressions for the MySql grammar #46538

Conversation

GeniJaho
Copy link
Contributor

Hello team 👋

I was migrating from Laravel 9 to 10 and got this error on some instances of using DB::raw():
TypeError: str_contains(): Argument #1 ($haystack) must be of type string, Illuminate\Database\Query\Expression given.

This error was not present in Laravel 9, and code like this ->select('*')->from('users')->whereNull(new Raw('id')) worked fine.

The issue was in whereNull() and whereNotNull() methods for the MySQL grammar. It has a different implementation from the other grammars for these two methods. I think we're only missing a check for raw DB expressions.

I hope these changes are correct or at least in the right direction.

@taylorotwell taylorotwell merged commit d5662cb into laravel:10.x Mar 21, 2023
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.

2 participants