From: wdolek at gmail dot com
Operating system: GNU/Linux
PHP version: 5.2.11
PHP Bug Type: Feature/Change Request
Bug description: ("" == NULL) == TRUE ?! (and all other "empty" values)
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 bug report at http://bugs.php.net/?id=50330&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50330&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50330&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50330&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50330&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50330&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50330&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50330&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50330&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50330&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50330&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50330&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50330&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50330&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50330&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50330&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50330&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50330&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50330&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50330&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50330&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50330&r=mysqlcfg