Issues with Entity save checks regarding changed values.

Created on 15 January 2025, about 1 month ago

Problem/Motivation

The Entity system has checks in place to reduce / optimize save operations, it seems to check whether an entity values have actually changed before performing a save, thus reducing unnecessary write operations.

These checks fail to detect a string field value change when the value was added leading zeros.

If I have defined an Entity's field as Text (plain) and assign a value of "1234", if I later change the value programmatically to "01234", a save operation is not triggered, while assigning a value of "0999" does.

"1234" and "01234" are not treated as different values even though the field is defined as string / text.

Steps to reproduce

1. Define a new Content Entity type with a field of type Text (plain)

2. Create a new entity, assigning "1234" as the field's value

3. Programmatically change the value to "01234" and save ($entity-save())

The save operations doesn't get triggered.

Proposed resolution

If a field is defined as text / string, the save checks on entities should treat "1234" and "01234" as different values.

πŸ› Bug report
Status

Active

Version

10.4 ✨

Component

entity system

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024