Skip to content

PHP 8.1 implictly converting from float to int loses precision in StringUtil.phpΒ #366

@Ian-Robinson1

Description

@Ian-Robinson1

SDK you're using (please complete the following information):

  • Version 2.32 (But the erronious line is present in the latest version as well)

Describe the bug
In PHP 8.1, it issues a warning when implicitly converting the $seconds variable to int in line 80 in StringUtil.php.

To Reproduce
Execute any code that enters the convertStringToDateTime function and enters the else statement

Additional Context
This can be fixed by changing line 80 in String Util.php from:

$datetime->setTimestamp($seconds);

To:

$datetime->setTimestamp((int)$seconds);

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