Bug #23860
closedInstallation on Windows causes Fatal error: Call to undefined method com::GetRandom() during 1-2-3 installer.
100%
Description
When installing on Windows Vista in a WAMP environment the install tool gives a fatal error:
Fatal error: Call to undefined method com::GetRandom() in t3lib\class.t3lib_div.php on line 1612
This seems to be caused by the CAPICOM service which is not registred.
For some reason (perhaps PHP changed some functionality) a Fatal error is given instead of an exception. Which is currently expected in that function.
As Microsoft no longer supports this object and advices to use a .NET object for this, the functionality need to be reviewed.
(issue imported from #M16154)
Files
Updated by Jean-Sébastien Gervais over 13 years ago
For windows users experiencing the same bug on windows XP / windows server 2003, it can easily be fixed by theses few steps :
1 - Download and install CAPICOM sdk from microsoft
http://www.microsoft.com/downloads/details.aspx?FamilyId=860EE43A-A843-462F-ABB5-FF88EA5896F6&displaylang=en
2 - register the dll for COM service (the newly installed dll can be found in the folder C:\Program Files\Fichiers communs\Microsoft Shared\CAPICOM) with this command :
regsvr32 capicom.dll
3 - Enjoy !
For devellopers,
maybe adding a better message could help people resolving the issue, as an alternative for a better workaround
new COM or die ('Please install CAPICOM ... ');
(EDIT: Had the issue with TYPO3 4.5 beta1, on windows XP)
Updated by Steffen Gebert over 13 years ago
Jens-Sebastian, could you be so kind and provide a patch against a subversion checkout of TYPO3, please?
Updated by Adrian Föder over 13 years ago
afraid I'm not able to provide a patch because I don't know how; but I patched the following:
try {
$com = new COM;
if(is_callable(array($com,'GetRandom')) {
$output = base64_decode($com->GetRandom($count, 0));
}
}
I "wrapped" the if() block around the $output-line to make sure the function call won't crash.
I had the same problem on my machine and this fix fixed it.
Updated by Adrian Föder over 13 years ago
oh, by the way, when the error reads "Call to undefined method com::GetRandom()" it is not a problem of lacking a registered CAPICOM dll. IF the CAPICOM DLL was not present, it would read "Invalid Syntax" and run into the exception, because new COM throws that error.
I was able to reproduce that; compare http://bugs.php.net/bug.php?id=48498
Reaching the line $output... means that the COM initialisation succeeded, but the lacking function "GetRandom" throws the fatal error.
Updated by Adrian Föder over 13 years ago
...just found out how to create a patch file on windows and added it.
Updated by Marcus Krause over 13 years ago
I'll have a look at the patch next week.
Updated by Adrian Föder over 13 years ago
two of our customers that were having this problem independently confirmed that the patch works.
I also evaluated that the is_callable returns true if the CAPICOM is installed and works.
Updated by Mcenal over 13 years ago
Found a solution using the new code in .NET for Windows 7 that replaces part of CAPICOM. Looks to work the same as the original.
try {
$com = new COM;
$output = base64_decode($com->GetBytes($count));
} catch (Exception $e) {
// RNGCryptoServiceProvider not installed
}
Updated by Anonymous almost 13 years ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset f7e9b0bc71906acc6bed19ab12fbb3dcbb1b592a.
Updated by Benni Mack almost 6 years ago
- Status changed from Resolved to Closed