On Mon, October 31, 2005 10:33 am, Marcus Bointon wrote: > On 31 Oct 2005, at 14:54, Chris Shiflett wrote: > >> Hopefully it is also clear that your argument revolves around the >> idea that PHP would create $_POST['foo'] as NULL if the checkbox is >> not checked. This is wrong for two reasons: > > No, no, that's not what I said - I wouldn't contemplate such > silliness! The thing I was wrong on is that PHP converts unset > parameters (as opposed to nonexistent ones which it obviously can't > do anything about) to an empty string, e.g. given ?a=&b=1, $_REQUEST > ['a'] is "", not NULL. However, it still serves to underline my other > point that using isset without actually knowing that is a potentially > dangerous thing. Getting into the habit of using it for looking in > the likes of $_REQUEST means you're likely to use it other places > where you have no such guarantee, and you'll have a bug to track > down. Using array_key_exists means you will never be exposed to this > possibility, no matter where your data comes from. Once again: HTTP and HTML have no NULL. It would be INSANE for PHP to interpret any HTTP data, which, by definition, is all TEXT as NULL. In the better part of a decade, I've never had a bug from using isset() and having NULL as a value in an array. I'm not really concerned about it happening tomorrow. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php