#50473 [NEW]: static dotnet classes can't be called
From: zelnaga at gmail dot com
Operating system: Windows XP
PHP version: 5.3.1
PHP Bug Type: COM related
Bug description: static dotnet classes can't be called
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 bug report at http://bugs.php.net/?id=50473&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50473&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50473&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50473&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50473&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50473&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50473&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50473&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50473&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50473&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50473&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50473&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50473&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50473&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50473&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50473&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50473&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50473&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50473&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50473&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50473&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50473&r=mysqlcfg
Thread (4 messages)
- zelnaga at gmail dot com