I am experiencing a pretty serious problem leading to data-loss in D7. Editing any existing node leads to empty body content and newly created nodes have no body content whatsoever.
Update: The error is reproducibly linked to the Locale module (v 7.78), disabling Locale leads to normal behavior, enabling it leads to data-loss when editing.
However, Locale has been enabled for a long time, so I am suspecting one of the updates since May 2020 (last time new content was added without problems) introduced a bug or a failed database update. So, there might be a bug in Locale that only shows under certain circumstances, e.g. PostgreSQL, a site migrated from D6 or Locale activated after content was already created, ...
The following observations are with Locale enabled:
Tracking an existing node in Postgres shows the node body content in field_data_body
before an edit.
After an edit, field_data_body
has no entry with the entity_id. I can put back the data using SQL and then the body content is displayed. Newly created nodes never get an entry in field_data_body
.
Therefore, I am suspecting something might be odd with HTML filtering (Filtered HTML, Plain text, ...) or the content edit form or language settings.
This is the original data of an existing node:
select * from field_data_body where entity_id = 745959;
entity_type | bundle | deleted | entity_id | revision_id | language | delta |
body_value | body_summary | body_format
-------------+--------+---------+-----------+-------------+----------+-------+----------------------------------------+--------------+-------------
node | blog | 0 | 745959 | 745959 | und | 0 | The genome browser is not working TEST | | 1
After editing:
select * from field_data_body where entity_id = 745959;
entity_type | bundle | deleted | entity_id | revision_id | language | delta | body_value | body_summary | body_format
-------------+--------+---------+-----------+-------------+----------+-------+------------+--------------+-------------
(0 rows)
Also, the node.language and field language are different:
select nid, n.language as "node-language", b.language as "field-language" from node as n left join field_data_body as b on n.nid=b.entity_id where nid = 745959;
nid | node-language | field-language
--------+---------------+----------------
745959 | en | und
(1 row)
Looks like it could indeed be a language setting conflict. When looking at the $form data, the values entered into body are found as such and only there.
So it indeed appears to be a language setting problem:
- create a new Page node: node.language is initially set to "en", the site default, no body data entry is created or saved upon edit (in form_data_body)
- In postgres, change node.language to "und"
- The body content is now saved upon edit and displayed properly