Req #35339 [Fbk->NoF]: COM "As" behaviour
| From: | php-bugs at lists dot php dot net | Date: | Sun, 29 Dec 2019 04:22:09 +0000 |
| Subject: | Req #35339 [Fbk->NoF]: COM "As" behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224584@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=35339&edit=1
ID: 35339
Updated by: php-bugs@lists.php.net
Reported by: amir at foresthc dot com
Summary: COM "As" behaviour
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: COM related
Operating System: Windows
PHP Version: Next Minor Version
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2019-12-16 08:55:34] cmb@php.net
Is this feature request still relevant? It seems to me that this
pattern (having a factory using an out parameter instead of
returning the instantiated object) is rather uncommon, and as such
it might not be worthwhile to add support for it.
------------------------------------------------------------------------
[2019-10-18 11:43:46] girgias@php.net
Assigning to cmb as he's the new maintainer for COM
------------------------------------------------------------------------
[2005-11-22 21:17:14] amir at foresthc dot com
Description:
------------
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.
$factory->Create_Product($product);
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
objFactory.Create_Product(objProduct)
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=35339&edit=1