Hi! > I suggested on IRC that empty strings, TRUE, FALSE, NULL, and values > that validate for the int type hint could be accepted. Is that a good > idea? Though it feels a bit loose, I think it covers all the > important common use cases.
Then you need to make all internal functions that accept bool work this way too. But I'm not sure why you need this. You accept that if("foo") works. Then why "function foo(bool $x) { if($x) { ... " should work differently? Yes, it is an edge case and bad code style. So are many other legal constructs. In my opinion, it is better to permit edge cases and be consistent than try to carve out perfect set of "what can be boolean" and get lost in the maze of exceptions and conditions. E.g. if we say we treat 1 and "1" mostly the same, then we should say "unless we convert them to bool in a context of a function call where they are not". I think it should be kept simpler - if we accept "foo" in boolean context, then we should just accept it. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php