|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-05-22 18:14 UTC] clement dot hallet at af83 dot com
Description: ------------ Hi, A call to the 'isset' function with a variable set to NULL returns FALSE. As seen on a previous report bug (http://bugs.php.net/bug.php?id=6076), the return value should be TRUE. Reproduce code: --------------- $a = NULL; var_dump(isset($a)); Expected result: ---------------- the return of isset($a) should be TRUE. Actual result: -------------- isset($a) returns FALSE PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 19:00:01 2025 UTC |
unfortunately no, because is_null on an unsetted variable returns TRUE. What I try to say is that's impossible to test if a variable has been set AND it has been set to NULL. For instance : if($whatever) { //case 1 $a = NULL; } elseif($whateverelse) { // case 2 $a = new SomeThing(); } else { // case 3 // do things but no set the $a variable; } it's impossible after that to make a difference between cases 1 and 3, because (excepting for case 2): isset($a) will return FALSE in both cases is_null($a) will return TRUE in both cases Sorry to insist, that way may have been declared as expected. But, I would like to make it understood before to consider it has a part of php.