File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -731,7 +731,7 @@ protected function shouldUpdate($row): bool
731
731
{
732
732
$ id = $ this ->getIdValue ($ row );
733
733
734
- return ! ($ id === null || $ id === []);
734
+ return ! ($ id === null || $ id === [] || $ id === '' );
735
735
}
736
736
737
737
/**
Original file line number Diff line number Diff line change @@ -42,6 +42,24 @@ public function testSaveNewRecordObject(): void
42
42
$ this ->seeInDatabase ('job ' , ['name ' => 'Magician ' ]);
43
43
}
44
44
45
+ /**
46
+ * @see https://github.com/codeigniter4/CodeIgniter4/issues/8613
47
+ */
48
+ public function testSaveNewRecordArrayWithEmptyStringId (): void
49
+ {
50
+ $ this ->createModel (JobModel::class);
51
+
52
+ $ data = [
53
+ 'id ' => '' ,
54
+ 'name ' => 'Magician ' ,
55
+ 'description ' => 'Makes peoples things dissappear. ' ,
56
+ ];
57
+
58
+ $ this ->model ->save ($ data );
59
+
60
+ $ this ->seeInDatabase ('job ' , ['name ' => 'Magician ' ]);
61
+ }
62
+
45
63
public function testSaveNewRecordArray (): void
46
64
{
47
65
$ this ->createModel (JobModel::class);
You can’t perform that action at this time.
0 commit comments