|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37892 $obj != null is incorrectly evaluated
Submitted: 2006-06-22 18:29 UTC Modified: 2006-06-22 18:56 UTC
From: randy at rcs-comp dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5CVS-2006-06-22 (snap) OS: Win XP Pro
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.
Block user comment
Status: Assign to:
Bug Type:
From: randy at rcs-comp dot com
New email:
PHP Version: OS:


 [2006-06-22 18:29 UTC] randy at rcs-comp dot com
When evaluating an instantiated object with "!=" the result is incorreclty returned as false;

Reproduce code:
echo phpversion();
class foo {
    var $test;

$obj = new foo();

if( $obj != null ) {
    echo "\n\ncorrect";
} else {
    echo "\n\nnot correct";

Expected result:
D:\tmp>"c:\Program Files\PHP514\php.exe" obj_null.php


Actual result:
D:\tmp>php obj_null.php

not correct


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-22 18:56 UTC]
Duplicate of #37806.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Oct 02 22:01:25 2023 UTC