From: paul at pcsmith dot co dot uk Operating system: Windows XP SP2 PHP version: 5.2.5 PHP Bug Type: Win32API related Bug description: COM API fails to correctly return [OUT] VT_PTR references
Description: ------------ I want to make a call to a com function defined in IDL as follows: /* DISPID=37 */ /* VT_I4 [3] */ function Connect( /* VT_VARIANT [12] [in] */ $SecurityToken, /* VT_BSTR [8] [in] */ $Workstation, /* VT_BSTR [8] [in] */ $Context, /* VT_PTR [26] [out] --> VT_PTR [26] */ &$Connection ) { /* method Connect */ } As you can see the fourth parameter is defined as [OUT] only and should return another com object created by the server. If I create an empty object for parameter 4 before the call and then make the call the script executes and the com server does the work properly. However the returned [OUT] &$Connection variable is still pointing to my original (empty) object and has not been replaced by the newly created object. The generated IDL clearly shows that the parameter is to be passed by reference - but PHP does not update/replace the passed in parameter. I have tried forcibly passing the parameter by reference (&) but it makes no difference. I have checked the bug database and other people seem to have reported similar(ish) problems that are supposedly fixed. This code definitely does not function as I would expect in 5.2.5 though. Reproduce code: --------------- // create empty object for call... $connection = new COM("AccServer.SAConnection"); // make call with dummy $connection object - this object should be replaced during the call $failurecode =$server->Connect($p1,$p2,$p3,$connection); Expected result: ---------------- I expect the 4th parameter ($connection) VT_PTR [OUT] to be replaced by the one passed back by the com object. Actual result: -------------- Parameter 4 is unchanged after the call. -- Edit bug report at http://bugs.php.net/?id=43470&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43470&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43470&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43470&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43470&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43470&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43470&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43470&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43470&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43470&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43470&r=support Expected behavior: http://bugs.php.net/fix.php?id=43470&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43470&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43470&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43470&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43470&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43470&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43470&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43470&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43470&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43470&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43470&r=mysqlcfg