Problem/Motivation
We encountered a fatal error when running update hooks (e.g., uninstalling a module or deleting a user role) on an environment using MySQL 8.0 (8.0.42-azure).
The error message is:
[error] SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'core_requirements_jwt': DELETE FROM "content_lock" WHERE ("entity_type" = :db_condition_placeholder_0) AND ("entity_id" = :db_condition_placeholder_1) ...
This happens because MySQL 8.0(8.0.42-azure) running in strict mode (STRICT_TRANS_TABLES) treats implicit type conversion truncation as a Fatal Error instead of a Warning (as in MySQL 5.7).
Steps to reproduce
1. Set up a Drupal site with content_lock enabled.
2. Ensure the database is MySQL 8.0 with STRICT_TRANS_TABLES enabled (default in Azure).
3. Trigger a deletion of a Configuration Entity (e.g., uninstalling a module like JWT, or deleting a User Role that has dependent actions in my case).
4. The system attempts to clean up locks for the deleted config entity.
5. The update process fails with the SQL error mentioned above.
Proposed resolution
Please take a look at my patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | content_lock-3571174-3.patch | 1.01 KB | yovince |
| #2 | content_lock-3571174_2.patch | 688 bytes | yovince |
Comments
Comment #2
yovinceThis patch works for me, but I'm not certain if it's the best way to fix it.
Comment #3
yovinceThis is for 3.x
Comment #4
alexpott@yovince I'm confused because we only try to release a lock if the entity type is lockable and we check that by doing \Drupal\content_lock\ContentLock\ContentLockInterface::isLockable() - config entities cannot end up in the lockable list unless some code or configuration not set via the form has occurred. Why is this returning TRUE for your user role?