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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC