[TYPO3-team-core-v5] Validation: should '123' be considered a valid float?

Karsten Dambekalns karsten at typo3.org
Fri Sep 26 20:44:25 CEST 2008


Hi.

I have been musing about validation. Problem is, we cannot simply use 
is_float(), is_integer() to check those two types - everything we get 
from the browser or command line is a string. So we need to handle 
numbers in strings. Ok, fine.

But there's a philosophical^W^Wanother point to the story: Imagine a 
"Weight Watchers" website. You need to enter your weight. The argument 
has been assigned a "float" validator.

You enter  |  Valid?
   87.5     |    Yes
   68.0     |    Yes
   100      |     No

Now, technically this might get a nod. But as a user you'd be stumped. 
Right? I mean, every kid knows 100 is the same as 100.0 or 100.00.


So, should we
  a) accept 100 as valid float or rather
  b) declare both int and float as acceptable in the example above?


Regards,
Karsten


More information about the TYPO3-team-core-v5 mailing list