[TYPO3-core] RFC: #10861: Eval of double2 doesn't work

Christian Kuhn lolli at schwarzbu.ch
Thu Apr 9 15:49:15 CEST 2009


Hi Steffen.

Steffen Kamper wrote:
> This is SVN patch request.
> 
> Type: Feature
> 
> Branches: trunk
> 
> BT reference: http://bugs.typo3.org/view.php?id=10861
> 
> Problem:
> If a field has eval double2 it should be result in a double with
> precision 2. This works for most values, but some not.
> Example:
> 
> -1,75 => -1.75
> 12 => 12.00
> 
> but
> 
> -0,75 => 0.75
> -,5 => 0.50
> 
> It's not possible to enter a value between -1 and 0
> 
> Solution:
> simplify and correct validation in JS and PHP
> 
> I attached a test extension with input field eval double2


Comparing new and old code I found these differences:

1) While current version just cuts to two decimals, number_format()
rounds. So 0.015 will be 0.01 in old and 0.02 in new version.

2) Space as thousand separator isn't recognized anymore: "1 222.33" was
"1222.33" before and now leads to "1.00".

3) A comma or dot as thousand separator leads to unexpected results in
both versions: The str_replace only removes space from $value, and
number_format() doesn't recognize it at all. We get two different wrong
values ;)

At the moment I only tested the TCE processing and disabled js parsing
in my tests.

I am unsure if we can use this version, maybe I am a bit too nitpicking,
but I think it is at least a different behavior and can't go to 4.2.


Regards
Christian


More information about the TYPO3-team-core mailing list