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

[9.x] Fixes 45582 issue 🔧 #45584

Merged
merged 2 commits into from
Jan 10, 2023
Merged

Conversation

imanghafoori1
Copy link
Contributor

@imanghafoori1 imanghafoori1 commented Jan 10, 2023

This fixes #45582
Since the Builder\Query flattens the binding array before applying it a method like whereIn can accept an associative array as its second argument (as demonstrated in the added tests).
So to make whereIntegerInRaw compatible with whereIn we need to flatten the values before casting it to int.
@staudenmeir

  • Missing tests are added.

image

  • The whereIn method tries to avoid accepting nested arrays as $values with the check below, but it is not enough and can be bypassed with an input like this:
 ->whereIn('id', [
     ['id' => 1 ], 
     ['id' => 2 ]
 ]) 

and due to the above flattening, it will continue to work as if it was called like this:

->whereIn('id', [1, 2])

image

@imanghafoori1 imanghafoori1 changed the title [9.x] Fixes 45582 issue [9.x] Fixes 45582 issue 🔧 Jan 10, 2023
@taylorotwell taylorotwell merged commit 30408c5 into laravel:9.x Jan 10, 2023
@imanghafoori1 imanghafoori1 deleted the fix_45582 branch January 10, 2023 14:26
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.

findMany breaking change
2 participants