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

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Jul 1 13:06:14 CEST 2008


Hi,

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.

So the JS on the client is ok, as soon as you send it to the server, 
TYPO3 will strip the "-" again.

Cheers,
Ernesto

Siller wrote: on 01.07.2008 09:43:
> 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