#23803 [Fbk->Opn]: disp_invokeex won't work with multiple args.

From: Date: Mon, 26 May 2003 03:23:58 +0000
Subject: #23803 [Fbk->Opn]: disp_invokeex won't work with multiple args.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40419@lists.php.net to get a copy of this message
ID: 23803 User updated by: eddie at omegaware dot com Reported By: eddie at omegaware dot com -Status: Feedback +Status: Open Bug Type: COM related PHP Version: 4.3.1 New Comment: 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.. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#40419) next »