|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69941 Casting a Variant object to boolean makes it false
Submitted: 2015-06-26 14:17 UTC Modified: 2015-06-26 17:14 UTC
From: Assigned: kalle (profile)
Status: Not a bug Package: COM related
PHP Version: 7.0.0alpha2 OS: Windows
Private report: No CVE-ID: None
 [2015-06-26 14:17 UTC]
Much like Bug #69939, this is the same is true for a Variant object:

var_dump((boolean) new Variant); // bool(true)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-26 14:17 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2015-06-26 14:37 UTC]
It seems to me that is intended behavior. If the first parameter
($value) is ommitted a VT_EMPTY object is created, which is
supposed to be treated as FALSE. The following yield TRUE, for

    (bool) new VARIANT(1)
    (bool) new VARIANT("foo")
    (bool) new VARIANT(true)
 [2015-06-26 17:14 UTC]
-Status: Assigned +Status: Not a bug
 [2015-06-26 17:14 UTC]
Agreed Chris, seems like com was the only instance of such
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 04:05:53 2022 UTC