Problem/Motivation

For some reason we observe that our scheduled updates entities have no update timestamp. When this is done, we retrieve exceptions on admin/content/scheduled_update:

The website encountered an unexpected error. Please try again later.

Exception: The timestamp must be numeric. in Drupal\Component\Datetime\DateTimePlus::createFromTimestamp() (line 172 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).
Drupal\Core\Datetime\DateFormatter->format('') (Line: 266)
Drupal\scheduled_updates\Entity\ScheduledUpdate->label() (Line: 77)
Drupal\scheduled_updates\ScheduledUpdateListBuilder->buildRow(Object) (Line: 229)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 22)
Drupal\Core\Entity\Controller\EntityListController->listing('scheduled_update')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Add a condition to ensure we at least don't fatal

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 2829883-2.patch1.35 KBdawehner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Status: Active » Needs review
FileSize
1.35 KB

Here is a possible fix.

tedbow’s picture

Status: Needs review » Needs work
+++ b/src/Entity/ScheduledUpdate.php
@@ -258,9 +260,14 @@ public static function bundleFieldDefinitions(EntityTypeInterface $entity_type,
+      return $this->t('No update time specified');

@dawehner thanks for reporting and the patch.
Should this say "Error: No update time specified"?

There should always be a numeric timestamp.

dawehner’s picture

Well, I had instances, not sure how to be honest, where we ended up with scheduled content entities without timestamps. I think this is highly related by our custom code, but well, fataling on the overview page is still not necessarily nice.

benjy’s picture

Status: Needs work » Reviewed & tested by the community

  • tedbow committed 9e986db on 8.x-1.x authored by dawehner
    Issue #2829883 by dawehner: admin/content/scheduled_update fatals when...
tedbow’s picture

Status: Reviewed & tested by the community » Fixed

@dawehner thanks for fixing this issue

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.