php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54683 $var = NULL; isset($var) return FALSE
Submitted: 2011-05-07 02:04 UTC Modified: 2011-07-15 11:45 UTC
From: langpavel at phpskelet dot org Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: langpavel at phpskelet dot org
New email:
PHP Version: OS:

 

 [2011-05-07 02:04 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-15 11:45 UTC] dsp@php.net
-Status: Open +Status: Bogus
 [2011-07-15 11:45 UTC] dsp@php.net
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


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC