Skip to content

Commit

Permalink
do not allow nested arrays in whereIn method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 19, 2022
1 parent e89b2b0 commit 140c3a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,10 @@ public function whereIn($column, $values, $boolean = 'and', $not = false)

$this->wheres[] = compact('type', 'column', 'values', 'boolean');

if (count($values) !== count(Arr::flatten($values, 1))) {
throw new InvalidArgumentException("Nested arrays may not be passed to whereIn method.");
}

// Finally, we'll add a binding for each value unless that value is an expression
// in which case we will just skip over it since it will be the query as a raw
// string and not as a parameterized place-holder to be replaced by the PDO.
Expand Down

0 comments on commit 140c3a8

Please sign in to comment.