php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43470 COM API fails to correctly return [OUT] VT_PTR references
Submitted: 2007-12-01 14:38 UTC Modified: 2007-12-03 11:07 UTC
Votes:13
Avg. Score:4.3 ± 1.2
Reproduced:11 of 11 (100.0%)
Same Version:5 (45.5%)
Same OS:4 (36.4%)
From: paul at pcsmith dot co dot uk Assigned:
Status: Open Package: COM related
PHP Version: 5.2.5 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: paul at pcsmith dot co dot uk
New email:
PHP Version: OS:

 

 [2007-12-01 14:38 UTC] paul at pcsmith dot co dot uk
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Oct 28 18:01:24 2020 UTC