Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#2 | 2829883-2.patch | 1.35 KB | dawehner |
|
Comments
Comment #2
dawehnerHere is a possible fix.
Comment #3
tedbow@dawehner thanks for reporting and the patch.
Should this say "Error: No update time specified"?
There should always be a numeric timestamp.
Comment #4
dawehnerWell, 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.
Comment #5
benjy CreditAttribution: benjy at PreviousNext commentedComment #7
tedbow@dawehner thanks for fixing this issue