Skip to content

PHP 8.4: implicit float-to-int conversion warnings in Str::durationForHumans() #14538

@SUXUMI

Description

@SUXUMI

Bug description

On PHP 8.4, Statamic\Support\Str::durationForHumans() emits Implicit conversion from float X to int loses precision warnings when called with a non-integer duration (e.g. a video/audio asset duration of 36.92 seconds).

How to reproduce

  1. Statamic v6.14 running on PHP 8.4.
  2. Upload a video or audio asset to a container whose metadata column exposes a non-integer duration (e.g. 36.92 seconds).
  3. Open any CP view that renders that asset's duration column (asset field flyout, asset container index, entry edit page with an asset field).
  4. Observe the Laravel error log / Ray / php-fpm error output:

Implicit conversion from float 36.92 to int loses precision in /.../vendor/statamic/cms/src/Support/Str.php on line 155
Implicit conversion from float 36.92 to int loses precision in /.../vendor/statamic/cms/src/Support/Str.php on line 156

Logs

Environment

- Statamic: 6.14.0
- Laravel: 12.x
- PHP: 8.4.19

Installation

Existing Laravel app

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions