Update Random_Compat to master.

This update mostly concerns OpenSSL being unusable on PHP 5.3~5.3.3.
See #28633, #34409

Built from https://develop.svn.wordpress.org/trunk@35410


git-svn-id: http://core.svn.wordpress.org/trunk@35374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2015-10-28 01:12:24 +00:00
parent 3def1c5014
commit 82d034a386
2 changed files with 23 additions and 15 deletions

View File

@ -30,16 +30,16 @@ if (!defined('PHP_VERSION_ID')) {
// This constant was introduced in PHP 5.2.7 // This constant was introduced in PHP 5.2.7
$RandomCompatversion = explode('.', PHP_VERSION); $RandomCompatversion = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($RandomCompatversion[0] * 10000 + $RandomCompatversion[1] * 100 + $RandomCompatversion[2])); define('PHP_VERSION_ID', ($RandomCompatversion[0] * 10000 + $RandomCompatversion[1] * 100 + $RandomCompatversion[2]));
unset($RandomCompatversion); $RandomCompatversion = null;
} }
if (PHP_VERSION_ID < 70000) { if (PHP_VERSION_ID < 70000) {
if (!defined('RANDOM_COMPAT_READ_BUFFER')) { if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
define('RANDOM_COMPAT_READ_BUFFER', 8); define('RANDOM_COMPAT_READ_BUFFER', 8);
} }
$__DIR__ = dirname(__FILE__); $RandomCompatDIR = dirname(__FILE__);
require_once $__DIR__.'/byte_safe_strings.php'; require_once $RandomCompatDIR.'/byte_safe_strings.php';
require_once $__DIR__.'/cast_to_int.php'; require_once $RandomCompatDIR.'/cast_to_int.php';
require_once $__DIR__.'/error_polyfill.php'; require_once $RandomCompatDIR.'/error_polyfill.php';
if (!function_exists('random_bytes')) { if (!function_exists('random_bytes')) {
/** /**
* PHP 5.2.0 - 5.6.x way to implement random_bytes() * PHP 5.2.0 - 5.6.x way to implement random_bytes()
@ -58,7 +58,7 @@ if (PHP_VERSION_ID < 70000) {
*/ */
if (extension_loaded('libsodium')) { if (extension_loaded('libsodium')) {
// See random_bytes_libsodium.php // See random_bytes_libsodium.php
require_once $__DIR__.'/random_bytes_libsodium.php'; require_once $RandomCompatDIR.'/random_bytes_libsodium.php';
} }
if ( if (
!function_exists('random_bytes') && !function_exists('random_bytes') &&
@ -75,7 +75,7 @@ if (PHP_VERSION_ID < 70000) {
// that is not helpful to us here. // that is not helpful to us here.
// See random_bytes_dev_urandom.php // See random_bytes_dev_urandom.php
require_once $__DIR__.'/random_bytes_dev_urandom.php'; require_once $RandomCompatDIR.'/random_bytes_dev_urandom.php';
} }
if ( if (
!function_exists('random_bytes') && !function_exists('random_bytes') &&
@ -83,7 +83,7 @@ if (PHP_VERSION_ID < 70000) {
extension_loaded('mcrypt') extension_loaded('mcrypt')
) { ) {
// See random_bytes_mcrypt.php // See random_bytes_mcrypt.php
require_once $__DIR__.'/random_bytes_mcrypt.php'; require_once $RandomCompatDIR.'/random_bytes_mcrypt.php';
} }
if ( if (
!function_exists('random_bytes') && !function_exists('random_bytes') &&
@ -94,20 +94,28 @@ if (PHP_VERSION_ID < 70000) {
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
if (method_exists($RandomCompatCOMtest, 'GetRandom')) { if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
// See random_bytes_com_dotnet.php // See random_bytes_com_dotnet.php
require_once $__DIR__.'/random_bytes_com_dotnet.php'; require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
} }
} catch (com_exception $e) { } catch (com_exception $e) {
// Don't try to use it. // Don't try to use it.
} }
unset($RandomCompatCOMtest); $RandomCompatCOMtest = null;
} }
if ( if (
!function_exists('random_bytes') && !function_exists('random_bytes') &&
extension_loaded('openssl') && extension_loaded('openssl') &&
PHP_VERSION_ID >= 50300 (
// Unix-like with PHP >= 5.3.0 or
(
DIRECTORY_SEPARATOR === '/' &&
PHP_VERSION_ID >= 50300
) ||
// Windows with PHP >= 5.3.4
PHP_VERSION_ID >= 50304
)
) { ) {
// See random_bytes_openssl.php // See random_bytes_openssl.php
require_once $__DIR__.'/random_bytes_openssl.php'; require_once $RandomCompatDIR.'/random_bytes_openssl.php';
} }
if (!function_exists('random_bytes')) { if (!function_exists('random_bytes')) {
/** /**
@ -123,7 +131,7 @@ if (PHP_VERSION_ID < 70000) {
} }
} }
if (!function_exists('random_int')) { if (!function_exists('random_int')) {
require_once $__DIR__.'/random_int.php'; require_once $RandomCompatDIR.'/random_int.php';
} }
unset($__DIR__); $RandomCompatDIR = null;
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta1-35409'; $wp_version = '4.4-beta1-35410';
/** /**
* 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.