Bug #69939 [Csd]: Casting object to bool returns false

From: Date: Fri, 26 Jun 2015 13:31:10 +0000
Subject: Bug #69939 [Csd]: Casting object to bool returns false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193911@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69939&edit=1

 ID:                 69939
 Updated by:         kalle@php.net
 Reported by:        bugzilla77 at gmail dot com
 Summary:            Casting object to bool returns false
 Status:             Closed
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows
 PHP Version:        7.0.0alpha2
-Assigned To:        
+Assigned To:        kalle
 Block user comment: N
 Private report:     N

 New Comment:

cmb, it seems like it was a port issue, should be fixed now


Previous Comments:
------------------------------------------------------------------------
[2015-06-26 13:30:21] kalle@php.net

Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85bbfb191d4d9b95e5155f7b21093e38557969f2
Log: Fixed bug #69939 (Casting object to bool returns false)

------------------------------------------------------------------------
[2015-06-26 13:05:13] cmb@php.net

It happens also with x86 builds, but as I said above, it doesn't
happen for general objects, but only for COM objects (and maybe
some others).

------------------------------------------------------------------------
[2015-06-26 12:57:26] kalle@php.net

Can you test to confirm if this differs between 32 bit and 64 bit builds of PHP 7.0.0 Alpha 2 and if
possible if it happens on non Windows on 7.0.0 Alpha 2?

If you don't have the chance to, then its fine and simply put the ticket back to
"Open", thanks

------------------------------------------------------------------------
[2015-06-26 12:56:12] cmb@php.net

Confirmed for COM objects, but not for objects in general, e.g.

  var_dump((bool) new StdClass); // => bool(true)
  var_dump((bool) new ArrayObject([])); // => bool(true)

------------------------------------------------------------------------
[2015-06-26 12:15:14] bugzilla77 at gmail dot com

Description:
------------
Casting object to bool returns false (in PHP 7.0)
Old PHP 5.6 returns true.

Test script:
---------------
<?php
 var_dump((bool)new COM('WScript.Shell'));
?>

Expected result:
----------------
true (like PHP 5.6)

Actual result:
--------------
false


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69939&edit=1


Thread (6 messages)

« previous php.bugs (#193911) next »