- Issue created by @butterwise
Attempting to delete a workspace (e.g. 'staging') results in an unexpected error:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'stage': DELETE FROM "linkchecker_index" WHERE ("entity_id" = :db_condition_placeholder_0) AND ("entity_type" = :db_condition_placeholder_1); Array ( [:db_condition_placeholder_0] => stage [:db_condition_placeholder_1] => workspace ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 763 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Database\StatementWrapperIterator->execute() (Line: 59)
Drupal\Core\Database\Query\Delete->execute() (Line: 146)
Drupal\linkchecker\LinkCleanUp->cleanUpForEntity() (Line: 202)
linkchecker_entity_delete()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 423)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 217)
Drupal\Core\Entity\EntityStorageBase->invokeHook() (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() (Line: 462)
Drupal\Core\Entity\EntityStorageBase->delete() (Line: 753)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (Line: 362)
Drupal\Core\Entity\EntityBase->delete() (Line: 71)
Drupal\Core\Entity\ContentEntityDeleteForm->submitForm()
call_user_func_array() (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 80)
Drupal\workspaces\Controller\WorkspacesHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)
This is because the linkchecker_index.entity_id column expects a numeric value, but 'stage' is a string, causing MySQL (or MariaDB) to try to coerce it into a number, which fails and throws the Invalid datetime format: 1292 error (a generic error MySQL throws for invalid type coercion).
Enable Linkchecker, then enable Workspaces. A default workspace with a machine name 'staging' is created. Attempting to delete this workspace results in the error above. Note that this means that the Workspace module cannot be uninstalled, since doing so requires that no workspaces exist.
One possible solution is to skip cleanup for unsupported entity types:
public function cleanUpForEntity(EntityInterface $entity) {
if ($entity->getEntityTypeId() === 'workspace') {
// Skip, as 'workspace' IDs are strings and incompatible with linkchecker_index expectations.
return;
}
...existing cleanup logic
}
Active
2.0
Code