|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #35339 COM "As" behaviour
Submitted: 2005-11-22 21:17 UTC Modified: 2015-01-08 23:55 UTC
From: amir at foresthc dot com Assigned:
Status: Open Package: COM related
PHP Version: 5.0.5 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
9 - 2 = ?
Subscribe to this entry?

 [2005-11-22 21:17 UTC] amir at foresthc dot com
In visual basic it is possible to declare a variable as a pointer to a certain type of object, but not instanciate it yet.

I have run into a problem using a 3rd party COM library, where it is neccessary to pass such an empty pointer by ref to a method, in order to get an instance or another class.

Reproduce code:
// This code is not real, it's just to illustrate the problem:

$factory = new COM('Example.Factory');

// Here we have several options, none of which work:
$product = new VARIANT;
$product = new COM('Example.Product');
variant_set_type($product, VT_EMPTY);

// Whatever I have done in the previous lines, this method fails. If it gets an instance of an instance of an object - it fails. If it gets anything that is not of type Example.Product, it fails.

Expected result:
Here is the "equivalent" VB code that works:

Dim objFactory As Example.Factory
Dim objProduct As Example.Product
// Any of these would fail:
Dim objProduct As New Example.Product
Dim objProduct As Variant

Sub Main()
    Set objFactory = new Example.Factory
End Sub

Actual result:
The Create_Product method will fail if it does not recieve the equivalent of the line: "Dim objProduct As Example.Product". Which as far as I can understand, is not possible to supply it with at this point.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:55 UTC]
-Package: Feature/Change Request +Package: COM related
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 05:01:26 2019 UTC