#23155 [Opn->Bgs]: The COM interface can't support pass by reference

From: Date: Thu, 10 Apr 2003 23:09:05 +0000
Subject: #23155 [Opn->Bgs]: The COM interface can't support pass by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37540@lists.php.net to get a copy of this message
ID: 23155 Updated by: phanto@php.net Reported By: wanght at hotmail dot com -Status: Open +Status: Bogus Bug Type: COM related Operating System: Window 2K English PHP Version: 4.3.1 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. call time pass by reference is a deprecated feature, use the variant class instead. Previous Comments: ------------------------------------------------------------------------ [2003-04-10 11:22:52] wanght at hotmail dot com I wrote a simple COM object using VC & ATL. Here a part of code HRESULT FetchValue([in, out]int* iValue, [out]int* iResult) STDMETHODIMP CSimpleCom::FetchValue(int* iValue, int* iResult) { int iTemp = *iValue + 10; *iValue = iTemp; *iResult = iTemp; return S_OK; } I wrote a PHP script to invoke this method. It can't get the new value from this function. <?php echo "Call Com Object<br>"; $instance = new COM("comtest.SimpleCom"); $value = 15; $result =10; $instance->FetchValue(&$value, &$result); echo "<b>Access function <i>void FetchValue(int*, int*): </i></b>"; echo "Output result: ".$result."<br>"; echo "Output value: ".$value."<br>"; $instance->release(); ?> After reading the source code, I found the function php_pval_to_variant in conversion.c didn't check if the variale is passed by reference. Am I right? Maybe this is the problem. By the way, this is a little bug in the COM interface function. php_VARIANT_call_function_handler (VARIANT.c) call function VariantInit(), and then call php_pval_to_variant_ex(conversion.c) --> php_pval_to_variant_ex2(conversion.c), the function VariantInit() has been called again. But in another invocation path do_COM_invoke(COM.c) -> php_pval_to_variant(conversion.c) -> php_pval_to_variant_ex2, the function VariantInit() is only invoked once. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23155&edit=1

« previous php.bugs (#37540) next »