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.
Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@xxxxxxxxxxxxxxxxxx | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php