php.net |  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
 [2006-06-22 18:29 UTC] randy at rcs-comp dot com
Description:
------------
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
5.1.4

correct

Actual result:
--------------
D:\tmp>php obj_null.php
5.2.0-dev

not correct

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-22 18:56 UTC] tony2001@php.net
Duplicate of #37806.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC