mirror of
https://github.com/WordPress/WordPress.git
synced 2024-06-25 06:14:58 +02:00
Update random_compat to latest
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. Merges [35922] to the 4.4 branch. Fixes #34948. Built from https://develop.svn.wordpress.org/branches/4.4@36058 git-svn-id: http://core.svn.wordpress.org/branches/4.4@36023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3a748c573f
commit
60965cc4a5
|
@ -90,15 +90,23 @@ if (PHP_VERSION_ID < 70000) {
|
||||||
extension_loaded('com_dotnet') &&
|
extension_loaded('com_dotnet') &&
|
||||||
class_exists('COM')
|
class_exists('COM')
|
||||||
) {
|
) {
|
||||||
try {
|
$RandomCompat_disabled_classes = preg_split(
|
||||||
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
|
'#\s*,\s*#',
|
||||||
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
|
strtolower(ini_get('disable_classes'))
|
||||||
// See random_bytes_com_dotnet.php
|
);
|
||||||
require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
|
|
||||||
|
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;
|
$RandomCompatCOMtest = null;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -62,16 +62,21 @@ 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
|
||||||
* If we don't set the stream's read buffer to 0, PHP will
|
*
|
||||||
* internally buffer 8192 bytes, which can waste entropy
|
* If we don't set the stream's read buffer to 0, PHP will
|
||||||
*
|
* internally buffer 8192 bytes, which can waste entropy
|
||||||
* 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')) {
|
*/
|
||||||
stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
|
if (function_exists('stream_set_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 {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4.1-alpha-36057';
|
$wp_version = '4.4.1-alpha-36058';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
Block a user