From:             
Operating system: Windows XP SP3
PHP version:      5.3.8
Package:          COM related
Bug Type:         Bug
Bug description:DOTNET .NET 4.0 GAC new location

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 bug report at https://bugs.php.net/bug.php?id=55847&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55847&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55847&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55847&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55847&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55847&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55847&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55847&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55847&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55847&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55847&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55847&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55847&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55847&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55847&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55847&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55847&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55847&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55847&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55847&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55847&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55847&r=mysqlcfg

Reply via email to