[TYPO3-core] RFC #5595: Bug: Fix in evalFunc_parseDouble() in t3lib/jsfunc.evalfield.js
Ernesto Baschny [cron IT]
ernst at cron-it.de
Fri Jul 18 20:54:45 CEST 2008
Sylvère "Siller" Störmann wrote: on 17.07.2008 10:42:
>> And why check if $value multiplied with hundred yields true. Or is this
>> what you're pointing out?
> Sorry for the late reply (been quite busy).
>
> The logic of this is for the unique case where a user enters "-0" as value
> --> $value = "0.00", $neg = '-'
> --> $value * 100 yields false
> --> return value is set to "0.00" ($value, instead of $neg.$value)
>
> If there wasn't the unary operator, the result would yield "-0.00"
> (which isn't mathematically correct).
> If we can assume that "-0.00" is correctly inserted as "0.00" by the
> DBAL, then it really is unnecessary.
Ok, but then you see that the "* 100" part is very uncommon and nobody
will understand that when looking at the code one year later.
I would simply say ($value === 0 ? $value : $neg.$value), which is what
you are trying to acchieve, isn't it? The $value is converted to int the
line before, so it should be ok to compare with (int)0.
Right?
Cheers,
Ernesto
More information about the TYPO3-team-core
mailing list