[TYPO3-core] RFC #5595: Bug: Fix in evalFunc_parseDouble() in t3lib/jsfunc.evalfield.js

Benjamin Mack benni at typo3.org
Thu Jan 1 18:04:42 CET 2009


Hey Sylvère,

just stumbled on your patch again.

could you please update your patch with Ernesto's latest remarks?

Thanks!
benni.

On 01.07.2008 9:43 Uhr, Siller wrote:
> This is a SVN patch request.
>
> Type: Bugfix
>
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=5595
>
> Branches:
> patches provided for trunk, TYPO3_4-1, and TYPO3_4-2
>
> Problem:
> The eval function evalFunc_parseDouble() for double2-fields yields
> incorrect results for values > -1.00 and < 0.00 (e.g. "-0.18" becomes
> "0.18"). This is due to the fact that the function uses
> evalFunc_parseInt to check the integer part of the float (i.e. anything
> before the decimal sign), whereas -0 becomes 0.
>
> Solution:
> My patch modifies the function by introducing a new local variable to
> store the leading sign (i.e. "" for positive and "-" for negative
> values). Furthermore, a simple ternary operation checks for "-0.00" to
> yield "0.00".
> Using this modified function the eval-function now yields:
> '' => '0' [because of if (!value) return 0;]
> '-' => '0.00'
> '-0' => '0.00'
> '-.4' => '-0.40'
> '-4' => '-4.00'
> '.4' => '0.40'
> '4' => '4.00'
>
> Just as it should! ;)
>
> Sylvère "Siller" Störmann.
>
>



More information about the TYPO3-team-core mailing list