Make WordPress Core


Ignore:
Timestamp:
10/09/2015 04:27:41 AM (9 years ago)
Author:
dd32
Message:

Use PHP7's random_int() CSPRNG functionality in wp_rand() with a fallback to the random_compat library for PHP 5.x.
random_compat offers a set of compatible functions for older versions of PHP, filling in the gap by using other PHP extensions when available.
We still include our existing wp_rand() functionality as a fallback for when no proper CSPRNG exists on the system.

Take Two, this was previously committed in [34922] but had an issue on PHP 5.2 which sarciszewski has now resolved.

Props sarciszewski
See #28633

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/compat.php

    r34924 r34981  
    333333    }
    334334}
     335
     336// random_int was introduced in PHP 7.0
     337if ( ! function_exists( 'random_int' ) ) {
     338    require ABSPATH . WPINC . '/random_compat/random.php';
     339}
Note: See TracChangeset for help on using the changeset viewer.