[TYPO3-core] RFC: Bug 4689: Error while entering a numbers like 50 or 50.00 into a double2 field

Michael Stucki michael at typo3.org
Tue Feb 6 14:39:45 CET 2007


Alright, so I committed it using (float).

- michael

Martin Kutschker wrote:

> Wolfgang Klinger schrieb:
>> *hiya!*
>> 
>> Michael Stucki wrote:
>> 
>>>Problem:
>>>Input fields with type "double2" should be converted into a floating
>>>field with 2 decimal points. However, the value in the database (e.g.
>>>50.00) will be converted into "50" upon save. Consequently, the
>>>comparison of TCEmain will fail, and an error is returned.
>>>
>>>Solution:
>>>Wrap the value with floatval() so that 50.00 returns 50, but 50.33 still
>>>works.
>>>
>>>Bugtracker reference:
>>>http://bugs.typo3.org/view.php?id=4689
>>>
>>>Branches:
>>>TYPO3_4-0 & Trunk
>> 
>> 
>> floatval depends on PHP 4 >= 4.2.0,
>> so you may consider typecasting instead
>> $something = (float)$something;
>> (though requirement for 4.1 is PHP 4.3)
>> 
>> However, +1
> 
> I tested (float)"1.0" and it yields 1, so please use this for TYPO3_4-0.
> 
> Masi

-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list