Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense [message #177019 is a reply to message #177017] |
Thu, 16 February 2012 13:22 |
Thomas Mlynarczyk
Messages: 131 Registered: September 2010
Karma:
|
Senior Member |
|
|
Michael Fesser schrieb:
> It might be ridiculous, but why is it unusable? Just define the options
> you need.
Technically you are right. It is usable. Just as a toothbrush is usable
to clean the floor of a building. Possible, but awkward.
>> I wondered if there was some hidden secret - none so far.
>
> I could imagine one. The meaning of the separators in a float number
> depends on the locale. Here in Germany for example the meaning is
> reversed. So IMHO it makes sense to force the developer to think about
> this potential issue and explicitly define the behaviour of this filter.
Indeed, that could be a reason. But then it would have been better to
make the "option" mandatory: you *have* to specify some value, if not --
error. Then the programmer would be forced to deal with the issue. The
way it is now, however, it's just a source of confusion, frustration and
hours of debugging. (Sure, just RTFM, but who in their right mind would
expect FILTER_SANITIZE_NUMBER_FLOAT to swallow up decimal separators?)
On the other hand I seriously question the concept of a server side
locale in the context of the world wide web. If locale must be, then it
ought to be the client's locale.
Greetings,
Thomas
--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
|
|
|