#23803 [Asn->WFx]: disp_invokeex won't work with multiple args.
| From: | iliaa@php.net | Date: | Sun, 17 Aug 2003 20:23:34 +0000 |
| Subject: | #23803 [Asn->WFx]: disp_invokeex won't work with multiple args. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46063@lists.php.net to get a copy of this message | ||
ID: 23803
Updated by: iliaa@php.net
Reported By: eddie at omegaware dot com
-Status: Assigned
+Status: Wont fix
Bug Type: COM related
PHP Version: 4.3.3-dev
Assigned To: wez
New Comment:
The com extension has been completely rewritten in PHP5 and the PHP4
com extension is no longer being maintained. If you find bugs with the
com extension in PHP5 please report them.
Previous Comments:
------------------------------------------------------------------------
[2003-05-26 14:52:06] wez@php.net
It's my mess, I'll clean it up
------------------------------------------------------------------------
[2003-05-25 22:23:57] eddie at omegaware dot com
The source code there looks exactly the same as my revision and the
code in
http://cvs.php.net/co.php/php4/ext/rpc/com/dispatch.c?login=2&r=1.7
I have just observed this problem from auditing the source as I don't
use this extension.. I ran my code which was using the same "for loop"
structure that the said function uses (initing the same zval for each
parameter and assigning it to the **params[] array) and it doens't work
there due to the problem that I mentioned..
------------------------------------------------------------------------
[2003-05-25 22:00:12] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-05-25 14:46:08] eddie at omegaware dot com
dispatch.c line 292 in function
static HRESULT STDMETHODCALLTYPE disp_invokdeex
will not give the expected results..
I found this while writing my own function to use call_user_function_ex
to call a function with params.. And was searching through the PHP code
to see how it was called elsewhere.. and this function is doing it the
same way I was doing it.. which doesn't work..
in line 270 a zval *zarg is allocated. then it is initialized once for
each argument.. the argument is assigned to the zarg then the address
of the zarg is stored in the **params[] array.
The problem is the *zarg has the same address for each iteration.. so
every params[i]=&zarg will assign the same address for every parameter
"i". so all the paramters will be the last parameter passed..
a zval ** needs to be allocated instead of a zval *.. so the address
is different for each parameter..
since I capped the maximum number of params I just allocate a zval
*zarg[4]; but a more dynamic solution would be better.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23803&edit=1