Make WordPress Core


Ignore:
Timestamp:
12/22/2015 03:22:05 AM (9 years ago)
Author:
dd32
Message:

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.

Location:
branches/4.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4

  • branches/4.4/src/wp-includes/random_compat/random.php

    r35600 r36058  
    9191            class_exists('COM')
    9292        ) {
    93             try {
    94                 $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
    95                 if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
    96                     // See random_bytes_com_dotnet.php
    97                     require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
     93            $RandomCompat_disabled_classes = preg_split(
     94                '#\s*,\s*#',
     95                strtolower(ini_get('disable_classes'))
     96            );
     97           
     98            if (!in_array('com', $RandomCompat_disabled_classes)) {
     99                try {
     100                    $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
     101                    if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
     102                        // See random_bytes_com_dotnet.php
     103                        require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
     104                    }
     105                } catch (com_exception $e) {
     106                    // Don't try to use it.
    98107                }
    99             } catch (com_exception $e) {
    100                 // Don't try to use it.
    101108            }
     109            $RandomCompat_disabled_classes = null;
    102110            $RandomCompatCOMtest = null;
    103111        }
Note: See TracChangeset for help on using the changeset viewer.