Entity attached to "original" property needs to be decrypted in update hooks

Created on 23 July 2024, 4 months ago

Problem/Motivation

If you implement an entity type update hook eg `my_module_node_update()`, you are unable to determine if an encrypted field value has changed by utilizing the `original` property as its fields are still encrypted.

Steps to reproduce

  1. Set up a `Test` content type with an encrypted text field `Test`
  2. Paste the example node update hook code below into a custom module
  3. Create a new `Test` node and then edit it and change the `Test` field value
  4. If you debug the node update hook code you will see the `$current_value` is correctly decrypted but the `$previous_value` is still encrypted.

Proposed resolution

Modify update hook code to also decrypt the `original` property if it exists.

🐛 Bug report
Status

Active

Version

3.1

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