Bug #93520
closed
Added by Christoph Werner almost 4 years ago.
Updated over 2 years ago.
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
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
Hi Česlav,
thanks for you explanation!
Than no bug, ticket can be closed.
Best,
Christoph
- 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.
Also available in: Atom
PDF