Skip to content

Commit e2cb789

Browse files
committed
Stop Dane from submitting invalid arrays and breaking the entire application...
1 parent aaf9666 commit e2cb789

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/Repositories/Eloquent/EloquentRepository.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ public function updateOrCreate(array $where, array $fields, $validate = true, $f
249249
Assert::boolean($validate, 'Third argument passed to updateOrCreate must be boolean, received %s.');
250250
Assert::boolean($force, 'Fourth argument passed to updateOrCreate must be boolean, received %s.');
251251

252+
foreach ($where as $item) {
253+
Assert::true(is_scalar($item) || is_null($item), 'First argument passed to updateOrCreate should be an array of scalar or null values, received an array value of %s.');
254+
}
255+
252256
$instance = $this->withColumns('id')->findWhere($where)->first();
253257

254258
if (! $instance) {

0 commit comments

Comments
 (0)