Edit report at http://bugs.php.net/bug.php?id=50473&edit=1

 ID:               50473
 Comment by:       pawel at atisoft dot poznan dot pl
 Reported by:      zelnaga at gmail dot com
 Summary:          static dotnet classes can't be called
 Status:           Open
 Type:             Bug
 Package:          COM related
 Operating System: Windows XP
 PHP Version:      5.3.1

 New Comment:

Reproduced in PHP 5.3.2

Same error while trying to instantiate other classes from mscorlib


Previous Comments:
------------------------------------------------------------------------
[2009-12-14 23:20:47] zelnaga at gmail dot com

Description:
------------
$test = new DOTNET('mscorlib', 'System.IO.File');



That yields a "Fatal error: Uncaught exception 'com_exception' with
message 'Failed to instantiate .Net object [CreateInstance] [0x80131513]
'" error.  Per the comments on php.net/class.dotnet, I thought this
might work, instead, but it doesn't:



$test = new DOTNET('mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089, processorArchitecture=x86',
'System.IO.File');



The example on php.net, however, does work:



$test = new DOTNET('mscorlib', 'System.Collections.Stack');



I think what the problem really is is this: System.IO.File is a static
class.  It's not intended to be instantiated whereas
System.Collections.Stack is.  In light of this, I think either the
ability to call methods within static dotnet classes ought to be added
or, failing that, a note should be added to the documentation stating
that only instantiatable classes can be used with the DOTNET object.

Reproduce code:
---------------
$test = new DOTNET('mscorlib', 'System.IO.File');

Expected result:
----------------
(nothing)

Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to
instantiate .Net object [CreateInstance] [0x80131513] ' in
C:\path\to\test.php:3

Stack trace:

#0 C:\path\to\test.php(3): dotnet->dotnet('mscorlib, Versi...

', 'System.IO.File')

#1 {main}

  thrown in C:\path\to\test.php on line 3


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50473&edit=1

Reply via email to