File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -728,6 +728,13 @@ public function insert($data = null, bool $returnID = true)
728728 // strip out created_at values.
729729 $ data = $ this ->doProtectFields ($ data );
730730
731+ // doProtectFields() can further remove elements from
732+ // $data so we need to check for empty dataset again
733+ if (empty ($ data ))
734+ {
735+ throw DataException::forEmptyDataset ('insert ' );
736+ }
737+
731738 // Set created_at and updated_at with same time
732739 $ date = $ this ->setDate ();
733740
@@ -866,6 +873,13 @@ public function update($id = null, $data = null): bool
866873 // strip out updated_at values.
867874 $ data = $ this ->doProtectFields ($ data );
868875
876+ // doProtectFields() can further remove elements from
877+ // $data so we need to check for empty dataset again
878+ if (empty ($ data ))
879+ {
880+ throw DataException::forEmptyDataset ('update ' );
881+ }
882+
869883 if ($ this ->useTimestamps && $ this ->updatedField && ! array_key_exists ($ this ->updatedField , $ data ))
870884 {
871885 $ data [$ this ->updatedField ] = $ this ->setDate ();
You can’t perform that action at this time.
0 commit comments