Can't cast COM objects to boolean
| Bug #38985 | Can't cast COM objects to boolean | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2006-09-28 19:55 UTC | Modified: | 2006-10-07 19:58 UTC |
|
||||||
| From: | larry dot menard at rogers dot com | Assigned: | ilia (profile) | |||||||
| Status: | Closed | Package: | COM related | |||||||
| PHP Version: | 5.2.0RC4 | OS: | Windows XP, SP2 | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2006-09-28 19:55 UTC] larry dot menard at rogers dot com
Description:
------------
First of all, I'm usng RC5, not RC4 (RC5 is not in the list above).
Can't cast an object of type COM to boolean.
Reproduce code:
---------------
$dbc = new COM('WinNT://Domain'); var_dump((bool)$dbc);
Expected result:
----------------
bool(true)
Actual result:
--------------
Catchable fatal error: Object of class com could not be converted to boolean
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-10-06 01:17 UTC] wez@php.net
[2006-10-06 06:48 UTC] tony2001@php.net
[2006-10-06 12:05 UTC] wez@php.net
I think this one liner will do the job, but haven't been able to verify it: Index: com_handlers.c =================================================================== RCS file: /repository/php-src/ext/com_dotnet/com_handlers.c,v retrieving revision 1.37 diff -u -p -r1.37 com_handlers.c --- com_handlers.c 29 Apr 2006 18:45:29 -0000 1.37 +++ com_handlers.c 6 Oct 2006 12:03:31 -0000 @@ -539,7 +539,7 @@ static int com_object_cast(zval *readobj return SUCCESS; } - return FAILURE; + return zend_std_cast_object_tostring(readobj, writeobj, type TSRMLS_CC); } static int com_object_count(zval *object, long *count TSRMLS_DC) cvs diff: Diffing tests[2006-10-06 12:25 UTC] edink@php.net
[2006-10-07 19:58 UTC] larry dot menard at rogers dot com