php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25137 !is_null($var) does not work the same as $var != NULL
Submitted: 2003-08-18 21:04 UTC Modified: 2003-08-19 03:01 UTC
From: pedropla at holidaymarketing dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.3RC4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pedropla at holidaymarketing dot com
New email:
PHP Version: OS:

 

 [2003-08-18 21:04 UTC] 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 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-18 21:05 UTC] pedropla at holidaymarketing dot com
sorry put it in the wrong section
 [2003-08-19 03:01 UTC] sniper@php.net
Works fine here. You must be doing something really wrong and as you didn't provide full script -> bogus.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC