- Issue created by @tstoeckler
Timestamp fields have a range constraint so that no value outside of the range of the database storage can be saved. The changed and created field types extend the timestamp field type but are missing that constraint. That means that invalid created or changed values that enter the system via a migration or JSON:API, for example, are not properly validated and may cause exceptions when being saved.
$node = Node::create([
'title' => 'Back to the future',
'type' => 'article',
// This is not a 32-bit integer.
'created' => 2147483649
]);
// This yields 0, thus no violation is recorded.
$node->validate()->count();
// Brace for SQL exception.
$node->save();
Copy the constraints over from TimestampItem
to CreatedItem
and ChangedItem
.
-
-
-
-
-
Active
11.0 🔥
field system