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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
7 + 45 = ?
Subscribe to this entry?

 
 [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: Fri Apr 19 14:01:30 2024 UTC