ID:               48364
 User updated by:  clement dot hallet at af83 dot com
 Reported By:      clement dot hallet at af83 dot com
 Status:           Bogus
 Bug Type:         Variables related
 Operating System: Mac OS X 10.5.6
 PHP Version:      5.2.9
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2009-05-22 19:19:14] paj...@php.net

is_null

------------------------------------------------------------------------

[2009-05-22 18:38:30] clement dot hallet at af83 dot com

Sorry for the bad status :)

Please note that because of :
 $a = NULL;
 isset($a) -> FALSE
 is_null($b) -> TRUE (a notice happend)

It's impossible to test if a variable is _set_ to NULL :/

------------------------------------------------------------------------

[2009-05-22 18:26:18] paj...@php.net

no bug > bogus :)

------------------------------------------------------------------------

[2009-05-22 18:23:11] clement dot hallet at af83 dot com

That bug report is void. Have seen
http://fr3.php.net/manual/en/function.isset.php

Maybe a change betweens versions ?

------------------------------------------------------------------------

[2009-05-22 18:14:32] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48364&edit=1

Reply via email to