php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38979 NULL
Submitted: 2006-09-28 07:40 UTC Modified: 2006-09-28 07:50 UTC
From: killabee at bk dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.4 OS: Linux Red Hat, Windows 2000
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: killabee at bk dot ru
New email:
PHP Version: OS:

 

 [2006-09-28 07:40 UTC] killabee at bk dot ru
Description:
------------
Expresions like (NULL == 0) or (NULL == '') evaluate to TRUE. I doubt whether it is correct, but unambiguously it is inconvenient. If a variable $Var = 0 or $Var = '' then empty($Var) returns TRUE, while isset($Var) returns 
TRUE too. From the other side when $Var = NULL isset($Var) returns FALSE. From this point empty string with 0 and NULL are not the same. Moreover manual says
"Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant." So why NULL is equal to 0 and '' then?
NULL means that variable has no value in php context or in other words is unset. So, I guess that check like $Var == NULL must has the same meaning like !isset($Var).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-28 07:50 UTC] tony2001@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: Wed Jul 16 01:01:32 2025 UTC