Req #54683 [NEW]: $var = NULL; isset($var) return FALSE
| From: | langpavel at phpskelet dot org | Date: | Sat, 07 May 2011 00:04:04 +0000 |
| Subject: | Req #54683 [NEW]: $var = NULL; isset($var) return FALSE | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160588@lists.php.net to get a copy of this message | ||
From:
Operating system: all
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:$var = NULL; isset($var) return FALSE
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 bug report at http://bugs.php.net/bug.php?id=54683&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54683&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54683&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54683&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54683&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54683&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54683&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54683&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54683&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54683&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54683&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54683&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54683&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54683&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54683&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54683&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54683&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54683&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54683&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54683&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54683&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54683&r=mysqlcfg