Project

General

Profile

Actions

Bug #93520

closed

Fluid: format.number

Added by Christoph Werner about 3 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2021-02-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hi!

I think I´ve discovered a bug in the fluid format.number function:

I put the following two examples in an fuid template:

<f:format.number decimalSeparator="." thousandsSeparator="">18,99</f:format.number>

Output > 18.00 < wrong, should bei 18.99

<f:format.number decimalSeparator="," thousandsSeparator="">18.99</f:format.number>

Output > 18,99 < is right

TYPO3 10.4.11 (didn´t saw a fix in versions 11 or 12)
PHP 7.2

Maybe someone can confirm that bug.
Thanks!
Best,
Christoph

Actions #1

Updated by Česlav Przywara about 3 years ago

Hi Christoph,

Try to run the following example via command line (this is what the view helper does internally):

php -r "echo number_format((float) '18,99', 2, '.', ',');" 

Or just:

php -r "echo (float) '18,99';" 

The problem you have is that 18,99 (a string) gets converted to 18 (a float). But that works as expected.

The view helper does not convert one number representation (with "," as decimal point) to another (with "." as decimal point). It converts float representation of a number to string representation with given decimal separator.

Cheers,
Česlav

Actions #2

Updated by Christoph Werner about 3 years ago

Hi Česlav,

thanks for you explanation!

Than no bug, ticket can be closed.

Best,
Christoph

Actions #3

Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from New to Closed

@christoph - Werner thank you for your reply and apologies for this very very late feedback.

I close this issue in agreement with the reporter.

If you think that this is the wrong decision or I have misunderstood or there is still work to be done, please reopen it or open a new issue with a reference to this one

Thank you.

Actions

Also available in: Atom PDF