Bug #29800 [Com]: new DOTNET fails for assemblys other than mscorlib
Edit report at https://bugs.php.net/bug.php?id=29800&edit=1
ID: 29800
Comment by: bszabolcs at gmail dot com
Reported by: christian at wenz dot org
Summary: new DOTNET fails for assemblys other than mscorlib
Status: No Feedback
Type: Bug
Package: COM related
Operating System: WinXP
PHP Version: 5.0.1
Block user comment: N
Private report: N
New Comment:
This bug is still present in PHP 5.3.8.
Here is the code I tried to use:
$sp = new DOTNET('System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089', 'System.IO.Ports.SerialPort');
The error message:
Fatal error: Uncaught exception 'com_exception' with message 'Failed to
instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such
interface supported '
Previous Comments:
------------------------------------------------------------------------
[2008-12-10 19:42:11] vince at siol dot net
Description:
---------------
As far as I can tell this bug is still present in 5.2.6. Using a fully qualified assembly name
reproduces a different error, so it might be a step closer to working.
Reproduce code:
---------------
$object = new DOTNET(
'System,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B77A5C561934E089',
'System.Diagnostics.Process' );
Expected result:
----------------
- no output --
Actual result:
---------------
PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to
instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported
'
------------------------------------------------------------------------
[2004-10-17 01:00:04] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2004-10-09 06:45:05] wez@php.net
Hey Christian,
You probably need to fully qualify the assembly name to get it working.
Here's a non-working example; the assembly is loaded but object unwrapping doesn't give us
an IDispatch'able handle, so instantiation fails.
Don't ask me how you determine the version and key tokens; I pulled these out of a decompiled
.tlb file :-/
$f = new
DOTNET('System.Windows.Forms,Version=1.0.5000.0,Culture=neutral,PublicKeyToken=b77a5c561934e089',
'System.Windows.Forms.Form');
PS: the next HEAD snapshot will contain better startup and error reporting for these things;
possibly fixing that other .net bug you reported a little while back.
------------------------------------------------------------------------
[2004-08-23 17:46:33] christian at wenz dot org
Description:
------------
The .NET sample from the manual (stack, Pop(), Push()) works fine with the new patch, however I
encounter problems instanciating .NET objects that are _not_ in mscorlib. I don't think there
is an error in my code.
Reproduce code:
---------------
<?php
$dotnetxsl = new DOTNET("System.Xml", "System.Xml.Xsl.XslTransform");
?>
Expected result:
----------------
no output
Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate
.Net object' in e:\Inetpub\wwwroot\php\dotnet1.php:2 Stack trace: #0 {main} thrown in
e:\Inetpub\wwwroot\php\dotnet1.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=29800&edit=1
Thread (9 messages)