Req #54683 [Opn->Bgs]: $var = NULL; isset($var) return FALSE
| From: | dsp@php.net | Date: | Fri, 15 Jul 2011 15:45:36 +0000 |
| Subject: | Req #54683 [Opn->Bgs]: $var = NULL; isset($var) return FALSE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161902@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54683&edit=1
ID: 54683
Updated by: dsp@php.net
Reported by: langpavel at phpskelet dot org
Summary: $var = NULL; isset($var) return FALSE
-Status: Open
+Status: Bogus
Type: Feature/Change Request
Package: *General Issues
Operating System: all
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2011-05-07 02:04:03] langpavel at phpskelet dot org
Description:
------------
---
From manual page: http://www.php.net/function.isset#Description
---
if valid variable $var with NULL value passed to isset(), result is FALSE.
There should be language reserved word/language construct that behaves exactly
like isset() except for NULL value.
behavior of isset should be changed in future major release, optionally
configurable by ini setting.
If I create patch, do you include it?
Note that if I'll go implement this, compatible behavior will be preserved.
Test script:
---------------
if(isset($var))
die('ERROR');
else
echo "OK\n";
$var = null;
if(!isset($var))
die('NOT GOOD. THIS IS UNCLEAR AND STRANGE');
else
echo "THIS IS BETTER\n";
unset($var);
if(isset($var))
die('ERROR');
else
echo "OK\n";
Expected result:
----------------
OK
THIS IS BETTER
OK
Actual result:
--------------
OK
NOT GOOD. THIS IS UNCLEAR AND STRANGE
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54683&edit=1