Skip to content

NumberFormatter and php 8 float to string conversion #164

@heinmekkes

Description

@heinmekkes

When not providing the decimal argument in NumberFormatter::format, it tries to determine the decimals from the stringified $number argument.

For this it uses the locale to find the decimal separator.
As the comment states // This is needed because (string)$number uses the locale's decimal separator.

This is no longer true since php 8.0. https://php.watch/versions/8.0/float-to-string-locale-independent.

This issue causes e.g. the Price element to lose any decimals in case a locale with a comma decimal separator is used.

It seems this is the case since version 2.0.3.

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