From 592163901a931fa54ffcb26d0e69168be448aa1b Mon Sep 17 00:00:00 2001 From: vibbow Date: Mon, 6 Apr 2020 18:52:40 +0800 Subject: [PATCH] Check if dataset is empty before Model update. Signed-off-by: vibbow --- system/Model.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/Model.php b/system/Model.php index 93d55feaa985..04a88df52574 100644 --- a/system/Model.php +++ b/system/Model.php @@ -817,6 +817,12 @@ public function update($id = null, $data = null): bool $data = (array) $data; } + // If it's still empty here, means $data is no change or is empty object + if (empty($data)) + { + throw DataException::forEmptyDataset('update'); + } + // Validate data before saving. if ($this->skipValidation === false) {