Skip to content

Commit 4a39882

Browse files
committed
Adds is_null check to Eloquent Builder callScope
1 parent f06f886 commit 4a39882

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Database/Eloquent/Builder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ protected function callScope(callable $scope, $parameters = [])
924924
// We will keep track of how many wheres are on the query before running the
925925
// scope so that we can properly group the added scope constraints in the
926926
// query as their own isolated nested where statement and avoid issues.
927-
$originalWhereCount = count($query->wheres);
927+
$originalWhereCount = is_null($query->wheres) ? 0 : count($query->wheres);
928928

929929
$result = $scope(...array_values($parameters)) ?: $this;
930930

0 commit comments

Comments
 (0)