|  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
 [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.


Add a Patch

Pull Requests

Add a Pull Request


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: Tue Apr 16 11:01:29 2024 UTC