Encrypted decimal field value not saved on drupal version 10.2.x+

Created on 20 November 2024, about 1 month ago

Problem/Motivation

On Drupal version 10.2.x+ encrypted decimal field values are no longer being saved.

This bug stems from a new decimal primitive data type that was added in 10.2.0 ( https://www.drupal.org/node/3376447 ). The decimal data type is not handled by the switch statement in \Drupal\field_encrypt\ProcessEntities::getUnencryptedPlaceholderValue , therefore this method returns NULL. This results in the field value getting set to NULL.

The value is still successfully encrypted and stored in encrypted_field_storage, however, when the entity is decrypted the stored value is not applied. This is because $field->getValue() returns an empty array so the field properties are not updated in \Drupal\field_encrypt\ProcessEntities::setEncryptedFieldValues.

Steps to reproduce

  1. Set up a Content Type with a encrypted Number (decimal) field.
  2. Create a node for that Content Type setting the decimal field value.
  3. The field value is not visible when viewing or editing the new node.

Proposed resolution

Update \Drupal\field_encrypt\ProcessEntities::getUnencryptedPlaceholderValue and add decimal data type to the switch statement.

🐛 Bug report
Status

Active

Version

3.2

Component

Code

Created by

🇨🇦Canada tame4tex

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024