Problem/Motivation

template_preprocess_locale_translation_last_check() passing NULL when no check is done (first run) to \Drupal\Core\Datetime\DateFormatterInterface::formatTimeDiffSince() - the cause of deprecation on PHP 8.1.

Steps to reproduce

Run core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php on PHP 8.1

Exception : Deprecated function: DateTime::setTimestamp(): Passing null to parameter #1 ($timestamp) of type int is deprecated
Drupal\Core\Datetime\DateFormatter->formatDiff()() (Line: 220)

Proposed resolution

Don't call formatTimeDiffSince() with NULL last check

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3240958-2.patch864 bytesandypost

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
StatusFileSize
new864 bytes
andypost’s picture

The template core/modules/locale/templates/locale-translation-last-check.html.twig using to check the same variable so "never" is displayed from there

alexpott’s picture

daffie’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

  • catch committed c30ae86 on 9.3.x
    Issue #3240958 by andypost, alexpott:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed c30ae86 and pushed to 9.3.x. Thanks!

Status: Fixed » Closed (fixed)

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