Re: bug #49510

From: Date: Sun, 15 Jul 2012 22:34:07 +0000
Subject: Re: bug #49510
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi!

> The question is more about the correctness of the doc, and to what I
> remember (I implemented that NULL on failure thing), the doc is wrong.

Well, the question is if '' is an acceptable boolean expressing false or
an error. I could see an argument for either, e.g. if you're having a
config file you could say for boolean config var 'foo_bar=0' and
'foo_bar=' means the same thing, or you could choose the second to be
invalid.
It is a bit complicated by the fact that people are somewhat confused
about the idea that filter_var works on strings, so they think boolean
'false' should be OK with it. Again, if we say foo_bar= is OK, then
false will be OK too, though not because of the reasons some people
think of.

> And the null on failure was mainly implemented for this exact case
> (boolean validation).

Yeah I understand that, the question is then if '' can be sought as a
valid boolean string meaning false, or as an error. I lean slightly to
the side of '' being accepted, but if somebody has any argument against
it, please let it be heard.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227




Thread (4 messages)

« previous php.internals (#61259) next »