Skip to content

[9.x] Fixes 45582 issue 🔧#45584

Merged
taylorotwell merged 2 commits into
laravel:9.xfrom
imanghafoori1:fix_45582
Jan 10, 2023
Merged

[9.x] Fixes 45582 issue 🔧#45584
taylorotwell merged 2 commits into
laravel:9.xfrom
imanghafoori1:fix_45582

Conversation

@imanghafoori1

@imanghafoori1 imanghafoori1 commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

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