Bug #75780
closedInvalid number format because of miscellaneous decimal separator
100%
Description
The fluid method format.number is not working properly anymore since this commit [[https://forge.typo3.org/projects/typo3cms-core/repository/revisions/608631a3a080ccb6436c7e277af036a0c6a0ccaa]]. The reason is, that this change specifies the LC_NUMERIC now correctly.
But the resulting problem is, that format.number only works with numbers, which have a point as decimal separator. But with a comma as saparator like in the locale de_DE, it won't work anymore. I resolved the problem with
setlocale(LC_NUMERIC, 'C');
but this is not a proper solution, because the bug is somewhere in fluid. It is also a problem for the VHS viewhelper (<v:math.round decimals="2">).
My example code:
<f:format.number decimals="2">
<v:math.division b="1048576">
<v:media.size path="public{downloadfile.identifier}"/>
</v:math.division>
</f:format.number>
Updated by Mathias Schreiber over 8 years ago
- Target version changed from 7.6.5 to Candidate for patchlevel
Updated by Christian Kuhn over 8 years ago
- Target version changed from Candidate for patchlevel to 7.6.5
linked to the offending issue for now.
at first glance it looks as if we should definitely revert the patch in 7.6, for master i'm not sure yet.
Updated by Nicole Cordes over 8 years ago
- Status changed from New to Needs Feedback
- Assignee set to Nicole Cordes
Hi,
can you please describe what your exact problem is?
I have following settings and can't reproduce any error:
config.locale_all = deu_deu (I'm on a windows system)
incoming value in NumberViewHelper: 24966,095238095
outcoming result (without warnings/errors): 24,966.00
Following fluid:
<f:format.number decimals="2"><f:cObject typoscriptObjectPath="lib.someLibObject" /></f:format.number>
Following TypoScript:
lib.someLibObject = TEXT
lib.someLibObject {
value = 1048576 / 42
prioriCalc = 1
}
Updated by Thomas Kieslich over 8 years ago
Hi
Displaying is not a Problem.
But if you have a FE Form to edit a extbase Object with float properties validating and saving are broken.
In the FloatConverter.php i found this line:
// We won't backport the full flavored locale parsing of floats from Flow here
Perhaps it help to start.
Updated by Gerrit Code Review over 8 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47825
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47825
Updated by Nicole Cordes over 8 years ago
- Status changed from Under Review to New
Hi Thomas,
we found out, your problem is not related to the topic. Would you mind to add a new bug report for this problem?
Updated by Nicole Cordes over 8 years ago
- Status changed from New to Needs Feedback
Hi D. Röhrig,
D. Röhrig wrote:
But the resulting problem is, that format.number only works with numbers, which have a point as decimal separator. But with a comma as saparator like in the locale de_DE, it won't work anymore. I resolved the problem with
can you please explain what is your incoming value before the patch and afterwards? It seems that neither vhs nor fluid convert any number with a comma as decimal separator. Unfortunately we haven't found any error this far.
Updated by Thomas Kieslich over 8 years ago
Hi Nicole,
you're right my problem is not primary format.number. But i think the root of the Problem is setlocale to.
I will add a new bug report.
Updated by Gerrit Code Review over 8 years ago
- Status changed from Needs Feedback to Under Review
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47828
Updated by Gerrit Code Review over 8 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47828
Updated by D. Röhrig over 8 years ago
Hi,
Nicole Cordes wrote:
It seems that neither vhs nor fluid convert any number with a comma as decimal separator. Unfortunately we haven't found any error this far.
when I understand you correctly, than you found the error already. vhs and fluid convert only numbers with point as decimal separator and not with comma as separator. This is the problem. I didn't find any limitation in docu and hope this was not intended.
Before the change not all values of localeconv() were changed. Specially 'decimal_point' was set to '.' (default value), although I set de_DE.UTF-8 in typoscript.
But now, it is set to ',', and all values in fluid are separated with comma and so the returning value is always zero for format.number.
Nicole Cordes wrote:
can you please explain what is your incoming value before the patch and afterwards?
Here are some more in and outcoming values:
<v:math.division b="1048576">
<v:media.size path="public{downloadfile.identifier}"/>
</v:math.division>
Before I got for example 0.644345364 and after 0,644345364.
When I wrap it with
<v:math.round></v:math.round>
or
<f:format.number decimals="2"></f:format.number>
before I got 0.64 and after only 0.
Is it comprehensible now?
Updated by Gerrit Code Review over 8 years ago
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47841
Updated by Nicole Cordes over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f2063acb6cc2e4c26b523aa8c26091493165a403.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed