[TYPO3-core] RFC #5595: Bug: Fix in evalFunc_parseDouble() in t3lib/jsfunc.evalfield.js
"Sylvère \"Siller\" Störmann"
sillermail at gmx.net
Tue Jul 1 16:11:35 CEST 2008
Hello,
> Looks good, but missing the part that saves the form (TCEmain). Please
> also modify t3lib/class.t3lib_tcemain.php accordingly (function
> checkValue_input_Eval), because there also the "intval()" php function
> is used on the integer part of the splitted value, causing the same effect.
thanks, I completely had forgotten about that part. ;)
> So the JS on the client is ok, as soon as you send it to the server,
> TYPO3 will strip the "-" again.
Additional patches for class.t3lib_tcemain.php attached. Now it works on
the server side as well.
Have a nice day!
Sylvère "Siller" Störmann.
Quote of original SVN patch request:
>> 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'
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_5595_t3lib_tcemain_T3_41.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080701/ca4b025a/attachment.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_5595_t3lib_tcemain_T3_42.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080701/ca4b025a/attachment-0001.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_5595_t3lib_tcemain_trunk.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080701/ca4b025a/attachment-0002.txt
More information about the TYPO3-team-core
mailing list