note 106488 deleted from function.isset by danbrown

From: Date: Tue, 15 Nov 2011 16:29:30 +0000
Subject: note 106488 deleted from function.isset by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184478@lists.php.net to get a copy of this message
Note Submitter: sijmen at ruwhof dot net ---- The isSet() function always returns false when checking the contents of a valid array entry, when the corresponding value is NULL. So, for example, the following check will always return boolean(false): <?php $test = array( 'a' => 1, 'b' => NULL, ); var_dump(isSet($test['b'])); # false ?> As a workaround for this behavior, when using the array_keys() function in combination with is_array(), the following statement will always return boolean(true): <?php $test = array( 'a' => 1, 'b' => NULL, ); var_dump(in_array('b', array_keys($test))); # true ?> I should also point out, that the script from poster 'pianistsk8er at gmail dot com' at '10-Dec-2004 03:23' has a few Local File Inclusion vulnerabilities, so don't use his script if you want to stay safe (!).

« previous php.notes (#184478) next »