Moin aus Bremen,
folgendes Problem beim Aufruf einer COM-Methode. Die Funktion ist (per com_print_typeinfo()) definiert als:
PHP-Code:
function SyncRead(
/* VT_I2 [2] [in] */ $Source,
/* VT_I4 [3] [in] */ $NumItems,
/* VT_PTR [26] [in] --> VT_SAFEARRAY [27] */ &$handles,
/* 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
)
// Versuch 1, $p1..$p4 unset:
PHP-Code:
$opcgroup->SyncRead(OPC_DS_CACHE, count($handles), $handles, $p1, $p2, $p3, $p4);
Ergebnis: com_exception: Parameter 4: Typkonflikt.
#0 opc_read_test.php(153): variant->SyncRead(1, 56, Array, NULL, NULL, NULL, NULL)
// ----------------------------------------
// Versuch 2:
PHP-Code:
$p1 = new VARIANT();
$p2 = new VARIANT();
$p3 = new VARIANT();
$p4 = new VARIANT();
$opcgroup->SyncRead(OPC_DS_CACHE, count($handles), $handles, $p1, $p2, $p3, $p4);
Ergebnis: com_exception: Parameter 4: Typkonflikt.
#0 opc_read_test.php(15

: variant->SyncRead(1, 56, Array, Object(variant), Object(variant), Object(variant), Object(variant))
// ----------------------------------------
// Versuch 3:
PHP-Code:
$p1 = array();
$p2 = array();
$p3 = array();
$p4 = array();
$opcgroup->SyncRead(OPC_DS_CACHE, count($handles), $handles, $p1, $p2, $p3, $p4);
Ergebnis: com_exception: Parameter 4: Typkonflikt.
#0 opc_read_test.php(15

: variant->SyncRead(1, 56, Array, Object(variant), Object(variant), Object(variant), Object(variant))
Ob $p1..$p4 mit oder ohne "&" übergeben werden ändert auch nichts.
Andere Funktionen des gleichen COM-Objekts funktionieren, wenn sie keine arrays per Referenz bekommen sollen.
Generell scheint die Übergabe von Arrays an COM-Objekte by reference nicht zu funktionieren.
Plattform: WinXP, PHP 5.2.9