|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13433 Returning Booleans from COM is broken in 407
Submitted: 2001-09-25 11:21 UTC Modified: 2001-10-04 14:30 UTC
From: peterd at telephonetics dot co dot uk Assigned:
Status: Closed Package: COM related
PHP Version: 4.0CVS-2001-09-25 OS: Windows NT 4 Server
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: peterd at telephonetics dot co dot uk
New email:
PHP Version: OS:


 [2001-09-25 11:21 UTC] peterd at telephonetics dot co dot uk
In PHP 4.07 (RC1, RC2 and latest snapshot, standard windows build) returning a boolean from a COM object is broken.

I reported this on PHP-QA a while ago but there was no response to it.  That report was primarily to do with returning booleans from a database accessed via an ADO COM object.  But now I've found it's true for all booleans.

When you have a COM object returning a boolean, testing that boolean for 'trueness' fails.

The following script:


$obj = new COM('com.object');

$arg = $obj->TestFunc();    // Simple function that just returns TRUE


if ($arg == TRUE)
   echo "arg is true<BR>";
elseif ($arg == FALSE)
   echo "arg is false<BR>";
   echo "arg is something else<BR>";

if ($arg)
  echo "<BR>arg is true, but not equal to true<BR>";

produces this output:

>arg is something else
>arg is true, but not equal to true

Basically, if you test for equality to 'true' it fails, but it's also not false.  But if you just test directly on the value it works fine.

I stepped through the source and it appears to be due to the way comparison of booleans is done.  The COM object returns a boolean by creating a Variant of type BOOL and value -1.  whereas PHP creates a boolean of type BOOL and value 1.  The comparison then messes up due to this, I think.

I've also tried this with PHP 4.06 and the problem doesn't occur in that version


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-04 14:30 UTC]
fixed in cvs
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun May 22 20:05:44 2022 UTC