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

 ID:                 55847
 Comment by:         user at kkdf2 dot sakura dot ne dot jp
 Reported by:        cosmin dot nicula at gmail dot com
 Summary:            DOTNET .NET 4.0 GAC new location
 Status:             Open
 Type:               Bug
 Package:            COM related
 Operating System:   Windows XP SP3
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Is it a problem on php settings, or need an extension to php dotnet?

If it is as a new feature, 
how about access to the newer .NET runtime?

new DOTNET4("...")

or

com.dotnet_runtime = "v4.0.30319" ; in php.ini

new DOTNET("...")

Have a good idea?

Thanks


Previous Comments:
------------------------------------------------------------------------
[2011-10-04 16:23:44] cosmin dot nicula at gmail dot com

Description:
------------
The DOTNET class in PHP seems to "look" only for CLR 2.0 assemblies and not for 
CLR 4.0 assemblies.

Since with .NET Framework 4.0, GAC was split in two, one for each CLR. The CLR 
for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0, and the CLR for 
.NET Framework 4.0 stands separately, not allowing CLR 2.0 applications to see 
CLR 4.0 assemblies.

The CLR 2.0 assemblies directory is located in: %windir%\assembly, whereas the 
CLR 4.0 assemblies directory is located in: %windir%\Microsoft.NET\assembly.

After installing an assembly in the GAC, if the targeted .NET Framework is 2.0 
or 3.5, the DOTNET constructor correctly identifies the Strong Named assembly. 
If the targeted .NET Framework is 4.0, the DOTNET constructor throws an 
exception "PHP Fatal error:  Uncaught exception 'com_exception' with message 
'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system 
cannot find the file specified.", although the assembly is correctly installed 
in the GAC under %windir%\Microsoft.NET\assembly directory with the gacutil 
tool.

Test script:
---------------
Test case1: install an assembly mylibrary.dll in the GAC with targeted .NET 
Framework 2.0 or 3.5.
%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe C:\mylibrary.dll
The following PHP snippet (replace ... with relevant info) correctly identifies 
the Strong Named assembly MyLibrary located in the %windir%\assembly folder.
<?php $myDotNetObject = new DOTNET('MyLibrary, Version=..., Culture=neutral, 
PublicKeyToken=...', 'MyLibrary.MainFunction'); ?>

Test case2: install an assembly mylibrary.dll in the GAC with targeted .NET 
Framework 4.0.
%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe 
C:\mylibrary.dll
The following PHP snippet (replace ... with relevant info) does not identifies 
the Strong Named assembly MyLibrary located in the 
%windir%\Microsoft.NET\assembly folder.
<?php $myDotNetObject = new DOTNET('MyLibrary, Version=..., Culture=neutral, 
PublicKeyToken=...', 'MyLibrary.MainFunction'); ?>

Expected result:
----------------
The following PHP snippet (replace ... with relevant info) should correctly 
indentify the Strong Named assembly MyLibrary located in the 
%windir%\Microsoft.NET\assembly folder.
<?php $myDotNetObject = new DOTNET('MyLibrary, Version=..., Culture=neutral, 
PublicKeyToken=...', 'MyLibrary.MainFunction'); ?>

Actual result:
--------------
The DOTNET constructor throws an exception "PHP Fatal error:  Uncaught 
exception 
'com_exception' with message 'Failed to instantiate .Net object 
[CreateInstance] 
[0x80070002] The system cannot find the file specified."


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



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

Reply via email to