php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #13577 is_null evaluates true for non-existent variables
Submitted: 2001-10-06 15:41 UTC Modified: 2002-06-10 05:15 UTC
From: sander@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.6 OS: Win2K & Debian Linux
Private report: No CVE-ID: None
 [2001-10-06 15:41 UTC] sander@php.net
is_null() evaluates true for non-existent variables. Consider the following snippet:

unset($foo);
if(is_null($foo))
  echo 'true';
else
  echo 'false';

It outputs 'true'.

Can this be fixed before 4.0.7?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-06 20:29 UTC] sniper@php.net
Intented behaviour. Not a bug.

 [2001-10-07 07:10 UTC] sander@php.net
If it's intended, then it should be documented.
Reopened as a documentation problem.
 [2001-10-07 09:57 UTC] jeroen@php.net
An uninitialized variable equals NULL. So it _is_ null.

This should be in the language.types.null section.
 [2002-06-10 05:15 UTC] mfischer@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Nov 19 13:00:01 2025 UTC