note 106488 added to function.isset

From: Date: Mon, 14 Nov 2011 00:17:50 +0000
Subject: note 106488 added to function.isset
Groups: php.notes 
Request: Send a blank email to php-notes+get-184419@lists.php.net to get a copy of this message
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 (!). ---- Server IP: 213.249.64.162 Probable Submitter: 77.251.102.205 ---- Manual Page -- http://www.php.net/manual/en/function.isset.php Edit -- https://master.php.net/note/edit/106488 Del: integrated -- https://master.php.net/note/delete/106488/integrated Del: useless -- https://master.php.net/note/delete/106488/useless Del: bad code -- https://master.php.net/note/delete/106488/bad+code Del: spam -- https://master.php.net/note/delete/106488/spam Del: non-english -- https://master.php.net/note/delete/106488/non-english Del: in docs -- https://master.php.net/note/delete/106488/in+docs Del: other reasons-- https://master.php.net/note/delete/106488 Reject -- https://master.php.net/note/reject/106488 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184419) next »