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
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 bug report at http://bugs.php.net/?id=35339&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35339&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35339&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35339&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35339&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35339&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35339&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35339&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35339&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35339&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35339&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35339&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35339&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35339&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35339&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35339&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35339&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35339&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35339&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35339&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35339&r=mysqlcfg