Update random_compat to latest master (~1.1.5)
Changes: * Checks `disable_classes` for `COM()` before using to avoid PHP Warnings * Uses `stream_set_chunk_size()` to avoid reading 8KiB from `/dev/urandom` unintentionally. See #34948 Built from https://develop.svn.wordpress.org/trunk@35922 git-svn-id: http://core.svn.wordpress.org/trunk@35886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
36e8fa050f
commit
ca7a95df36
|
@ -90,6 +90,12 @@ if (PHP_VERSION_ID < 70000) {
|
||||||
extension_loaded('com_dotnet') &&
|
extension_loaded('com_dotnet') &&
|
||||||
class_exists('COM')
|
class_exists('COM')
|
||||||
) {
|
) {
|
||||||
|
$RandomCompat_disabled_classes = preg_split(
|
||||||
|
'#\s*,\s*#',
|
||||||
|
strtolower(ini_get('disable_classes'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!in_array('com', $RandomCompat_disabled_classes)) {
|
||||||
try {
|
try {
|
||||||
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
|
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
|
||||||
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
|
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
|
||||||
|
@ -99,6 +105,8 @@ if (PHP_VERSION_ID < 70000) {
|
||||||
} catch (com_exception $e) {
|
} catch (com_exception $e) {
|
||||||
// Don't try to use it.
|
// Don't try to use it.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$RandomCompat_disabled_classes = null;
|
||||||
$RandomCompatCOMtest = null;
|
$RandomCompatCOMtest = null;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -62,6 +62,7 @@ function random_bytes($bytes)
|
||||||
$fp = false;
|
$fp = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!empty($fp)) {
|
||||||
/**
|
/**
|
||||||
* stream_set_read_buffer() does not exist in HHVM
|
* stream_set_read_buffer() does not exist in HHVM
|
||||||
*
|
*
|
||||||
|
@ -70,9 +71,13 @@ function random_bytes($bytes)
|
||||||
*
|
*
|
||||||
* stream_set_read_buffer returns 0 on success
|
* stream_set_read_buffer returns 0 on success
|
||||||
*/
|
*/
|
||||||
if (!empty($fp) && function_exists('stream_set_read_buffer')) {
|
if (function_exists('stream_set_read_buffer')) {
|
||||||
stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
|
stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
|
||||||
}
|
}
|
||||||
|
if (function_exists('stream_set_chunk_size')) {
|
||||||
|
stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$bytes = RandomCompat_intval($bytes);
|
$bytes = RandomCompat_intval($bytes);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-35920';
|
$wp_version = '4.5-alpha-35922';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue