php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4614 Empty strings are also considered as NULL
Submitted: 2000-05-26 16:09 UTC Modified: 2000-05-26 16:11 UTC
From: stephane dot legrand at bigfoot dot com Assigned:
Status: Closed Package: Other
PHP Version: 4.0.0 Release OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stephane dot legrand at bigfoot dot com
New email:
PHP Version: OS:

 

 [2000-05-26 16:09 UTC] stephane dot legrand at bigfoot dot com
<?
        $test = "";
        if ($test == NULL) {
                print("test is NULL <br>\n");
        }
?>

With PHP4, this code displays "test is NULL".
With PHP3, this code displays nothing.

- it seems to me that PHP3 has a far more logical behaviour.
- i think it can be a big incompatibility problem between PHP3 and PHP4.

So, is it a bug or a feature ? And is there a way to force PHP4 to act like PHP3 in this particular case ?

Thank you.
Stephane Legrand.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-26 16:11 UTC] andrei at cvs dot php dot net
The value of "" and NULL do compare the same. To test for
equivalence use === operator.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 17:03:54 2023 UTC