Bug #69941 [Asn->Nab]: Casting a Variant object to boolean makes it false

From: Date: Fri, 26 Jun 2015 17:14:38 +0000
Subject: Bug #69941 [Asn->Nab]: Casting a Variant object to boolean makes it false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193921@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69941&edit=1 ID: 69941 Updated by: kalle@php.net Reported by: kalle@php.net Summary: Casting a Variant object to boolean makes it false -Status: Assigned +Status: Not a bug Type: Bug Package: COM related Operating System: Windows PHP Version: 7.0.0alpha2 Assigned To: kalle Block user comment: N Private report: N New Comment: Agreed Chris, seems like com was the only instance of such Previous Comments: ------------------------------------------------------------------------ [2015-06-26 14:37:02] cmb@php.net 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 instance: (bool) new VARIANT(1) (bool) new VARIANT("foo") (bool) new VARIANT(true) ------------------------------------------------------------------------ [2015-06-26 14:17:00] kalle@php.net Description: ------------ Much like Bug #69939, this is the same is true for a Variant object: var_dump((boolean) new Variant); // bool(true) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69941&edit=1

« previous php.bugs (#193921) next »