From:             pedropla at holidaymarketing dot com
Operating system: Linux
PHP version:      4.3.3RC4
PHP Bug Type:     Scripting Engine problem
Bug description:  !is_null($var) does not work the same as $var != NULL

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 bug report at http://bugs.php.net/?id=25137&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25137&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25137&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25137&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25137&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25137&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25137&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25137&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25137&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25137&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25137&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25137&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25137&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25137&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25137&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25137&r=gnused

Reply via email to