Make WordPress Core


Ignore:
Timestamp:
02/16/2022 09:17:04 PM (3 years ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update random_compat to version 2.0.21.

The latest release includes improved compatibility with PHP 8.1, as well as some bug fixes for Windows platforms.

Release notes:
https://github.com/paragonie/random_compat/releases/tag/v2.0.21

For a full list of changes in this update, see the random_compat GitHub:
https://github.com/paragonie/random_compat/compare/v2.0.11...v2.0.21

Follow-up to [42130].

Props jrf, paragoninitiativeenterprises.
Fixes #55181.

File:
1 edited

Legend:

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

    r46586 r52742  
    44 * for using the new PHP 7 random_* API in PHP 5 projects
    55 *
    6  * @version 2.0.10
    7  * @released 2017-03-13
     6 * @version 2.0.17
     7 * @released 2018-07-04
    88 *
    99 * The MIT License (MIT)
    1010 *
    11  * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
     11 * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
    1212 *
    1313 * Permission is hereby granted, free of charge, to any person obtaining a copy
     
    5555$RandomCompatDIR = dirname(__FILE__);
    5656
    57 require_once $RandomCompatDIR . '/byte_safe_strings.php';
    58 require_once $RandomCompatDIR . '/cast_to_int.php';
    59 require_once $RandomCompatDIR . '/error_polyfill.php';
     57require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'byte_safe_strings.php';
     58require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'cast_to_int.php';
     59require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'error_polyfill.php';
    6060
    6161if (!is_callable('random_bytes')) {
     
    7777        // See random_bytes_libsodium.php
    7878        if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
    79             require_once $RandomCompatDIR . '/random_bytes_libsodium.php';
     79            require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_libsodium.php';
    8080        } elseif (method_exists('Sodium', 'randombytes_buf')) {
    81             require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php';
     81            require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_libsodium_legacy.php';
    8282        }
    8383    }
     
    118118
    119119            // See random_bytes_dev_urandom.php
    120             require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php';
     120            require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_dev_urandom.php';
    121121        }
    122122        // Unset variables after use
     
    160160    ) {
    161161        // See random_bytes_mcrypt.php
    162         require_once $RandomCompatDIR . '/random_bytes_mcrypt.php';
     162        require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_mcrypt.php';
    163163    }
    164164    $RandomCompatUrandom = null;
     
    183183            try {
    184184                $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
    185                 if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
     185                /** @psalm-suppress TypeDoesNotContainType */
     186                if (is_callable(array($RandomCompatCOMtest, 'GetRandom'))) {
    186187                    // See random_bytes_com_dotnet.php
    187                     require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php';
     188                    require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_com_dotnet.php';
    188189                }
    189190            } catch (com_exception $e) {
     
    204205         *
    205206         * @param mixed $length
    206          * @return void
     207         * @psalm-suppress InvalidReturnType
    207208         * @throws Exception
     209         * @return string
    208210         */
    209211        function random_bytes($length)
     
    213215                'There is no suitable CSPRNG installed on your system'
    214216            );
     217            return '';
    215218        }
    216219    }
     
    218221
    219222if (!is_callable('random_int')) {
    220     require_once $RandomCompatDIR . '/random_int.php';
     223    require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_int.php';
    221224}
    222225
Note: See TracChangeset for help on using the changeset viewer.