|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-04-14 11:06 UTC] pawel at atisoft dot poznan dot pl
[2012-12-09 23:44 UTC] ben at nullcreations dot net
[2020-02-08 11:32 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2020-02-08 11:32 UTC] cmb@php.net
[2020-02-23 22:38 UTC] cmb@php.net
-Type: Bug
+Type: Documentation Problem
[2020-03-14 15:36 UTC] cmb@php.net
[2020-03-14 15:36 UTC] cmb@php.net
-Status: Assigned
+Status: Closed
[2020-03-14 15:36 UTC] cmb@php.net
[2020-03-14 15:38 UTC] phpdocbot@php.net
[2020-03-14 23:03 UTC] mumumu@php.net
[2020-03-14 23:05 UTC] phpdocbot@php.net
[2020-12-30 11:59 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 06:00:01 2025 UTC |
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