Re: why is '01' == '1.'?
| From: | Greg Beaver | Date: | Thu, 15 Dec 2005 14:33:39 +0000 |
| Subject: | Re: why is '01' == '1.'? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21230@lists.php.net to get a copy of this message | ||
Stefan Walk wrote:
> See http://bugs.php.net/bug.php?id=23110
>
> It's definitely a gotcha, especially if you use switch(){}, as there
> is no way to do strict type checking there.
Please reconsider the decision to leave this bug open in PHP, any
unexpected behavior in an operator as fundamental as == is VERY
dangerous, and if used improperly could lead to security holes (i.e.
unexpectedly, input that does not match could match a strict filter
based on ==)
I understand the rationale behind loosely typed comparison, and use it
myself, but this is beyond loosely typed, it is explicitly changing type
in an irrational way, as it only applies in certain cases.
Greg