php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4765 $NULL / $null are equal to 0
Submitted: 2000-06-01 22:44 UTC Modified: 2000-06-02 12:16 UTC
From: nic at undiluted dot org Assigned:
Status: Closed Package: Other
PHP Version: 4.0.0 Release OS: linux kernel 2.2.14
Private report: No CVE-ID: None
 [2000-06-01 22:44 UTC] nic at undiluted dot org
I was getting some error In a larger script I wrote which worked fine with php3..x.  For some reason thou I came to find out that $null or $NULL was equal to 0 for some reason.  I dont know if this was intended or not but if it wasn't that seems like a bug to me anyways.  Usually null is set to be equal to \0 maybe the \ is missing somewhere or something.  

here is a small script to try to see the results I got.
<?
$test = 0;
if ($test == $NULL)
        print "yes";
else
        print "No";
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-02 12:16 UTC] stas at cvs dot php dot net
It's 0 because it's unset. $NULL is no better and no worse than $foobar. Both are plain variables.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Oct 03 05:05:53 2022 UTC