Closed svendecabooter closed 8 years ago
This issue will be a critical blocker for sites that need to encrypt financial data, for example. It already is for me.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: '[ENCRYPTED]' for column 'field_price_value' at row 1: INSERT INTO {node__field_price} (entity_id, revision_id, bundle, delta, langcode, field_price_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 1165 [:db_insert_placeholder_1] => 1165 [:db_insert_placeholder_2] => example [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => [ENCRYPTED] ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 757 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
If I recall, we had to set values because the solution did not work without it. (e.g. something in core was expecting some value).
Theres two avenues here...
I have created a new PR that sets some sensible placeholder values, based on the property data type.
We should indeed probably explore how we can let Drupal core know that there is a particular value for the field (stored encrypted elsewhere), without having to provide a placeholder.
But until we've found a way to handle that (if possible at all), the PR at least makes sure that current core field types don't result in errors when trying to encrypt them.
This is a follow-up to https://github.com/d8-contrib-modules/field_encrypt/pull/38