Ask a Question related to PHP Development, Design and Development.
-
pedropla at holidaymarketing dot com #1
#25137 [Opn]: !is_null($var) does not work the same as $var != NULL
ID: 25137
User updated by: pedropla at holidaymarketing dot com
Reported By: pedropla at holidaymarketing dot com
Status: Open
-Bug Type: Scripting Engine problem
+Bug Type: Variables related
Operating System: Linux
PHP Version: 4.3.3RC4
New Comment:
sorry put it in the wrong section
Previous Comments:
------------------------------------------------------------------------
[2003-08-18 21:04:22] pedropla at holidaymarketing dot com
Description:
------------
Since upgrading to php:
PHP 4.3.3RC3 (cli) (built: Aug 16 2003 11:22:58)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend
Technologies
it seems that many of my php programs which use !
is_null($var) have broken, however when I replace the
function is_null for a comparison: $var != NULL, it works.
Is this a bug? Or some new "feature"?
Many thanks
Reproduce code:
---------------
Fails:
function name ($setTo=NULL)
{
if (! is_null($setTo))
{
return "Not null";
}
return "null";
}
Works:
function name ($setTo=NULL)
{
if ($setTo != NULL)
{
return "Not null";
}
return "null";
}
Expected result:
----------------
return null when null and not null when not null
Actual result:
--------------
works only with comparison != and not with !is_null()
function
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=25137&edit=1[/url]
pedropla at holidaymarketing dot com Guest
-
#40791 [NEW]: isset - null - is_null
From: mauthi at gmx dot net Operating system: PHP version: 5.2.1 PHP Bug Type: *General Issues Bug description: isset -... -
#25292 [Bgs]: is_null(1) and comparison with null produce different results
ID: 25292 Updated by: sniper@php.net Reported By: dizza at students dot ru Status: Bogus Bug Type: ... -
#25292 [Opn->Bgs]: is_null(1) and comparison with null produce different results
ID: 25292 Updated by: sniper@php.net Reported By: dizza at students dot ru -Status: Open +Status: ... -
#25137 [Opn->Bgs]: !is_null($var) does not work the same as $var != NULL
ID: 25137 Updated by: sniper@php.net Reported By: pedropla at holidaymarketing dot com -Status: Open +Status: ... -
#25137 [NEW]: !is_null($var) does not work the same as $var != NULL
From: pedropla at holidaymarketing dot com Operating system: Linux PHP version: 4.3.3RC4 PHP Bug Type: Scripting Engine...



Reply With Quote

