ID:               48061
 Updated by:       w...@php.net
 Reported By:      kmb at kai-m-becker dot de
-Status:           Assigned
+Status:           Open
 Bug Type:         COM related
 Operating System: Windows XP SP3
 PHP Version:      5.2.9
 Assigned To:      wez


Previous Comments:
------------------------------------------------------------------------

[2009-04-23 13:43:07] kmb at kai-m-becker dot de

Description:
------------
When calling a COM method with an array argument by reference, a
com_exception "type mismatch" is thrown. 

Problem occurs only with arrays(!) as arg by ref. 
Scalar types work fine as arg by ref.

php-5.2.9\ext\com_dotnet\com_com.c shows that the exception comes from
IDispatch_Invoke() (Windows-API) called in php_com_invoke_helper().

Reproduce code:
---------------
$opc = new COM('Matrikon.OPC.Automation'); // <-- certified COM App
$opc->Connect('Matrikon.OPC.Simulation.1');
$opcgroup = $opc->OPCGroups->Add("mes");

// some code to fill $serverhandles

$values = array();
$errors = array();
$qualities = array();
$timestamps = array();

// function SyncRead( // acc. to com_print_typeinfo() and OPC-spec.
//    /* VT_I2 [2] [in] */ $Source,
//    /* VT_I4 [3] [in] */ $NumItems,
//    /* VT_PTR [26] [in] --> VT_SAFEARRAY [27]  */ &$ServerHandles,
//    /* VT_PTR [26] [out] --> VT_SAFEARRAY [27]  */ &$Values,
//    /* VT_PTR [26] [out] --> VT_SAFEARRAY [27]  */ &$Errors,
//    /* VT_PTR [26] [out] --> VT_VARIANT [12]  */ &$Qualities,
//    /* VT_PTR [26] [out] --> VT_VARIANT [12]  */ &$TimeStamps
//    )

$opcgroup->SyncRead(
   OPC_DS_CACHE, count($serverhandles), $serverhandles, // [in] args
   $values, $errors, $qualities, $timestamps // [out] args
);

Expected result:
----------------
Successful call to SyncRead().

Actual result:
--------------
com_exception: Parameter 4: Typkonflikt (= type mismatch)

#0 opc_read_test.php(148): variant->SyncRead(1, 56, Array,
Object(variant), Object(variant), Object(variant), Object(variant))
#1 {main}



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


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

Reply via email to