#50330 [Opn->Bgs]: ("" == NULL) == TRUE ?! (and all other "empty" values)
| From: | philip@php.net | Date: | Tue, 01 Dec 2009 06:41:57 +0000 |
| Subject: | #50330 [Opn->Bgs]: ("" == NULL) == TRUE ?! (and all other "empty" values) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-145257@lists.php.net to get a copy of this message | ||
ID: 50330
Updated by: philip@php.net
Reported By: wdolek at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: GNU/Linux
PHP Version: 5.2.11
New Comment:
This will never change.
- http://www.php.net/manual/en/types.comparisons.php
It is what it is.
Previous Comments:
------------------------------------------------------------------------
[2009-11-30 10:23:04] wdolek at gmail dot com
Description:
------------
when comparing empty string, empty array, FALSE, integer 0 with NULL,
comparison always returns TRUE. but imho empty string, FALSE or 0 are
still any values, instead of NULL is "no" value.
of course, i can use === but documentation says "equals" - isn't is
little bit confusing to check also type, when NULL has no type?
in whatever programming lanugage, NULL is NULL and not anything else,
don't know, why PHP behaves differently
Reproduce code:
---------------
// should be array(), 0, FALSE etc. instead of ''
if ('' == NULL) {
echo 'hey dummy, empty string should not be NULL!';
} else {
echo 'yeah, empty string is not NULL at all!';
}
Expected result:
----------------
yeah, empty string is not NULL at all!
Actual result:
--------------
hey dummy, empty string should not be NULL!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50330&edit=1