php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #39831 Error in loose comparison table (EMPTY STRING and NULL)
Submitted: 2006-12-14 11:40 UTC Modified: 2006-12-14 16:45 UTC
From: florian at in dot tum dot de Assigned: colder (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: any
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: florian at in dot tum dot de
New email:
PHP Version: OS:

 

 [2006-12-14 11:40 UTC] florian at in dot tum dot de
Description:
------------
Correction:
-------------
the manual's comparison tables (appendix P) say that the loose comparison between the EMPTY STRING and NULL evaluates to FALSE, but actually this is not correct.
And therefore that evaluation does espacially not match the behavior of is_null()...

is_null("")        //=> FALSE
("" == NULL)    //=> TRUE, not false


(I've tested it quite intensely, on linux as well as on windows, different PHP versions etc.)

(btw., I've posted this issue as a note on the documentation page, sorry for that. could any-one delet it, maybe? thanks.) 


Reproduce code:
---------------
print( ("" == null) ? "true <br />" : "false <br />" );
print( (is_null("")) ? "true <br />" : "false <br />" );

Expected result:
----------------
false
false

Actual result:
--------------
true
false

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-14 16:45 UTC] colder@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Aug 05 15:00:03 2025 UTC