Bug #64130 [Opn->Ver]: COM obj parameters passed by reference are not updated
Edit report at https://bugs.php.net/bug.php?id=64130&edit=1
ID: 64130
Updated by: cmb@php.net
Reported by: bmiller dot qw at gmail dot com
Summary: COM obj parameters passed by reference are not
updated
-Status: Open
+Status: Verified
Type: Bug
Package: COM related
Operating System: Windows
PHP Version: 5.4.11
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2013-02-01 19:14:19] bmiller dot qw at gmail dot com
Description:
------------
I found that COM ByRef parameters where still being treated as ByVal parameters - only for "out
of process" com objects.
I debugged the COM extension (or COM_DOTNET) and found that in function;
php_com_get_id_of_name() (in com_com.c)
was calling "hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);" to
get the com object dispatch id from the member name.
For out of process objects this will always return E_NOTIMPL.
Thus the iTypeInfo object (obj->typeinfo) would be destroyed.
The final result would be that ByRef parameters would NOT be detected.
Easy fix; Just ALWAYS use the IDispatch_GetIDsOfNames and only use iTypeInfo for the
ITypeInfo_GetTypeComp call - which is what we need.
Test script:
---------------
//(need MS word) or any app that has a COM interface
$word = new COM("word.application") or die("Unable to instantiate Word");
$word->Visible = 1;
/*
In the com_com.c, place a breakpoint at:
hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
It will always return E_NOTIMPL then the code deletes obj->typeinfo which
ultimately causes the problem
*/
Expected result:
----------------
If the com object function call used references then the variable would be changed.
Sorry I couldn't find a public COM object off hand that passed variables by reference.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64130&edit=1
Thread (6 messages)