For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > December 2006 > #39831 [Opn->Csd]: Error in loose comparison table (EMPTY STRING and NULL)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #39831 [Opn->Csd]: Error in loose comparison table (EMPTY STRING and NULL)
colder@php.net

2006-12-14, 7:00 pm

ID: 39831
Updated by: colder@php.net
Reported By: florian at in dot tum dot de
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: any
PHP Version: Irrelevant
-Assigned To:
+Assigned To: colder
New Comment:

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.




Previous Comments:
------------------------------------------------------------------------

[2006-12-14 11:40:26] 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


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39831&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com