X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/03f2fa83c13c1b532284205fa7efcab9b8b2c41f..0459461f9ea42e0b090759ff6fe5f48360bef750:/wp-includes/random_compat/random.php diff --git a/wp-includes/random_compat/random.php b/wp-includes/random_compat/random.php index d1f7555a..f6ffc54f 100644 --- a/wp-includes/random_compat/random.php +++ b/wp-includes/random_compat/random.php @@ -56,7 +56,7 @@ if (PHP_VERSION_ID < 70000) { * * See ERRATA.md for our reasoning behind this particular order */ - if (extension_loaded('libsodium')) { + if (PHP_VERSION_ID >= 50300 && extension_loaded('libsodium') && function_exists('\\Sodium\\randombytes_buf')) { // See random_bytes_libsodium.php require_once $RandomCompatDIR.'/random_bytes_libsodium.php'; } @@ -90,15 +90,23 @@ if (PHP_VERSION_ID < 70000) { 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 = preg_split( + '#\s*,\s*#', + strtolower(ini_get('disable_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 (