Bug #23860
closed
Installation on Windows causes Fatal error: Call to undefined method com::GetRandom() during 1-2-3 installer.
Added by Peter Beernink about 14 years ago.
Updated about 6 years ago.
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
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)
Jens-Sebastian, could you be so kind and provide a patch against a subversion checkout of TYPO3, please?
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.
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.
...just found out how to create a patch file on windows and added it.
I'll have a look at the patch next week.
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.
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
}
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF