Skip to content

Commit 2238bf1

Browse files
committed
fix: check if index exists
1 parent f9cc163 commit 2238bf1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

system/BaseModel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,13 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
997997
// Save updateIndex for later
998998
$updateIndex = $row[$index] ?? null;
999999

1000+
if ($updateIndex === null) {
1001+
throw new InvalidArgumentException(
1002+
'The index ("' . $index . '") for updateBatch() is missing in the data: '
1003+
. json_encode($row)
1004+
);
1005+
}
1006+
10001007
// Must be called first so we don't
10011008
// strip out updated_at values.
10021009
$row = $this->doProtectFields($row);

0 commit comments

Comments
 (0)