[TYPO3-core] RFC #5595: Bug: Fix in evalFunc_parseDouble() in t3lib/jsfunc.evalfield.js
Siller
sillermail at gmx.net
Tue Jul 1 09:43:16 CEST 2008
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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_5595_T3_41.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080701/e4892b00/attachment.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_5595_T3_42.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080701/e4892b00/attachment-0001.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_5595_trunk.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080701/e4892b00/attachment-0002.txt
More information about the TYPO3-team-core
mailing list