From: kmb at kai-m-becker dot de
Operating system: Windows XP SP3
PHP version: 5.2.9
PHP Bug Type: COM related
Bug description: Exception when passing array by ref to COM method
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 bug report at http://bugs.php.net/?id=48061&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48061&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48061&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48061&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48061&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48061&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48061&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48061&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48061&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48061&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48061&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48061&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48061&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48061&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48061&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48061&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48061&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48061&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48061&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48061&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48061&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48061&r=mysqlcfg