php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69939 Casting object to bool returns false
Submitted: 2015-06-26 12:15 UTC Modified: 2015-06-26 13:31 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bugzilla77 at gmail dot com Assigned: kalle (profile)
Status: Closed Package: *General Issues
PHP Version: 7.0.0alpha2 OS: Windows
Private report: No CVE-ID: None
 [2015-06-26 12:15 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-26 12:56 UTC] cmb@php.net
-Summary: Casting object to bool returns false +Summary: Casting COM object to bool returns false -Status: Open +Status: Verified
 [2015-06-26 12:56 UTC] 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:57 UTC] kalle@php.net
-Summary: Casting COM object to bool returns false +Summary: Casting object to bool returns false -Status: Verified +Status: Feedback
 [2015-06-26 12:57 UTC] 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 13:05 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2015-06-26 13:05 UTC] 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 13:30 UTC] 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:30 UTC] kalle@php.net
-Status: Open +Status: Closed
 [2015-06-26 13:31 UTC] kalle@php.net
-Assigned To: +Assigned To: kalle
 [2015-06-26 13:31 UTC] kalle@php.net
cmb, it seems like it was a port issue, should be fixed now
 [2015-07-07 23:37 UTC] ab@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)
 [2016-07-20 11:38 UTC] davey@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)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC