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_bytes_com_dotnet.php

    r46586 r52742  
    11<?php
    22/**
    3  * Random_* Compatibility Library 
     3 * Random_* Compatibility Library
    44 * for using the new PHP 7 random_* API in PHP 5 projects
    5  * 
     5 *
    66 * The MIT License (MIT)
    7  * 
    8  * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
    9  * 
     7 *
     8 * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
     9 *
    1010 * Permission is hereby granted, free of charge, to any person obtaining a copy
    1111 * of this software and associated documentation files (the "Software"), to deal
     
    1414 * copies of the Software, and to permit persons to whom the Software is
    1515 * furnished to do so, subject to the following conditions:
    16  * 
     16 *
    1717 * The above copyright notice and this permission notice shall be included in
    1818 * all copies or substantial portions of the Software.
    19  * 
     19 *
    2020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2121 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     
    4242    {
    4343        try {
     44            /** @var int $bytes */
    4445            $bytes = RandomCompat_intval($bytes);
    4546        } catch (TypeError $ex) {
     
    5556        }
    5657
     58        /** @var string $buf */
    5759        $buf = '';
    5860        if (!class_exists('COM')) {
     
    6163            );
    6264        }
     65        /** @var COM $util */
    6366        $util = new COM('CAPICOM.Utilities.1');
    6467        $execCount = 0;
     
    6972         */
    7073        do {
    71             $buf .= base64_decode($util->GetRandom($bytes, 0));
     74            $buf .= base64_decode((string) $util->GetRandom($bytes, 0));
    7275            if (RandomCompat_strlen($buf) >= $bytes) {
    7376                /**
    7477                 * Return our random entropy buffer here:
    7578                 */
    76                 return RandomCompat_substr($buf, 0, $bytes);
     79                return (string) RandomCompat_substr($buf, 0, $bytes);
    7780            }
    7881            ++$execCount;
Note: See TracChangeset for help on using the changeset viewer.