Skip to content

Commit

Permalink
Handle disabled classes
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-scott committed Dec 9, 2015
1 parent a208865 commit 5f727f8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lib/random.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,23 @@
extension_loaded('com_dotnet') &&
class_exists('COM')
) {
try {
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
// See random_bytes_com_dotnet.php
require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
$RandomCompat_disabled_classes = explode(
',',
ini_get('disabled_classes')
);

if (!in_array('COM', $RandomCompat_disabled_classes)) {
try {
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
// See random_bytes_com_dotnet.php
require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
}
} catch (com_exception $e) {
// Don't try to use it.
}
} catch (com_exception $e) {
// Don't try to use it.
}
$RandomCompat_disabled_classes = null;
$RandomCompatCOMtest = null;
}
if (
Expand Down

0 comments on commit 5f727f8

Please sign in to comment.