ID: 32026
Updated by: [EMAIL PROTECTED]
Reported By: csaba at alum dot mit dot edu
-Status: Open
+Status: Feedback
Bug Type: COM related
Operating System: Win XP Pro
PHP Version: 5CVS-2005-02-19
New Comment:
Please paste the IDL for that method into this bug report.
You can view the IDL using the OleView tool.
Previous Comments:
------------------------------------------------------------------------
[2005-02-19 11:09:13] csaba at alum dot mit dot edu
Description:
------------
If I try to make a call to a function where the function has a
paramArray (a VB construct) in the definition, the call fails with (if
the param array gets at least one argument).
For the unfamiliar, a paramArray in VB is an array (of variants) which
consists of all the remaining arguments to the procedure. As such, it
must be the last declared parameter in the Function declaration.
Csaba Gabor from Vienna
Reproduce code:
---------------
Here is the PHP test code (menu.php):
<?php
$oTool = new COM("Menu.Tool");
$result = $oTool->ArgCount ("junk", 5, 13);
print $result;
?>
Here is the code for the Menu.OCX file:
Public Function ArgCount(Arg1, ParamArray paArgRest())
'counts the number of arguments passed, excluding Arg1
ArgCount = UBound(paArgRest) + 1 - LBound(paArgRest)
End Function
Notes:
This was built using VB5CCE (the free (while available) VB, Control
Creation Edition)
I have named my control Tool
I have named the Project Menu
I made the OCX into Menu.ocx
In the (VB5CCE) project I went to Project => Menu Properties =>
Component tab and set No Compatibility
After I made Menu.OCX, from the directory Menu.ocx resides in, I did:
regsvr32 Menu.ocx
Here is the corresponding VBScript test file (menu.vbs) that works:
Set oTool = CreateObject("Menu.Tool")
result = oTool.ArgCount("junk", 5, 13)
MsgBox result
Expected result:
----------------
I expect to see a 2 printed or displayed (since there are two arguments
after "junk")
Actual result:
--------------
menu.vbs produces the expected 2.
menu.php file fails with:
Cannot pass parameter 2 by reference in C:\Testing\ParamArray\menu.php
on line 3
If the paramArray gets no elements
$result = $oTool->ArgCount ("junk");
then I get the expected 0
I've inserted a
com_print_typeinfo($oTool) and received (there was other code in
menu.ocx):
/* DISPID=1610809344 */
/* VT_VARIANT [12] */
function ArgCount(
/* VT_PTR [26] [in][out] --> VT_VARIANT [12] */
&$Arg1,
/* VT_PTR [26] [in][out] --> ? [27] */ &$paArgRest
)
{
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32026&edit=1