Problem/Motivation

When rendering the block plugin, I get the deprecation warning: "Implicit conversion from float 24.821526716109474 to int loses precision in Drupal\Core\Datetime\DateFormatter->formatInterval() (line 154 of core/lib/Drupal/Core/Datetime/DateFormatter.php)."

This appears to be due to the DateIntervalStatistic trait calling formatInterval() on a floatval, which implicitly gets rounded.

Steps to reproduce

Insert the Queue statistics list block on a page and render it, ensure some items are in queue.

Proposed resolution

Explicitly round the floatval before formatting with formatInterval().

Remaining tasks

Review patch.

CommentFileSizeAuthor
queue_stats.patch498 bytesachton

Comments

achton created an issue. See original summary.

  • 40a02c96 committed on 2.x
    fix: #3427731 Implicit conversion from float to int
    
    By: achton
    
kasperg’s picture

Status: Needs review » Fixed

Merged. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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