Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #35339 : COM "As" behaviour
User Name
REGISTER NOW! Mark Forums Read

sponsored links

1 24th April 10:30
External User
Posts: 1
Default #35339 : COM "As" behaviour

From: amir at foresthc dot com
Operating system: Windows
PHP version: 5.0.5
PHP Bug Type: Feature/Change Request
Bug description: COM "As" behaviour

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.

Edit bug report at
Try a CVS snapshot (php4):
Try a CVS snapshot (php5.0):
Try a CVS snapshot (php5.1):
Fixed in CVS:
Fixed in release:
Need backtrace:
Need Reproduce Script:
Try newer version:
Not developer issue:
Expected behavior:
Not enough info:
Submitted twice:
PHP 3 support discontinued:
Daylight Savings:
IIS Stability:
Install GNU Sed:
Floating point limitations:
No Zend Extensions:
MySQL Configuration Error:
  Reply With Quote

  sponsored links


Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -