- Timestamp:
- 02/16/2022 09:17:04 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/random_compat/random_bytes_libsodium.php
r46586 r52742 1 1 <?php 2 2 /** 3 * Random_* Compatibility Library 3 * Random_* Compatibility Library 4 4 * for using the new PHP 7 random_* API in PHP 5 projects 5 * 5 * 6 6 * The MIT License (MIT) 7 7 * 8 * Copyright (c) 2015 - 201 7Paragon Initiative Enterprises9 * 8 * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises 9 * 10 10 * Permission is hereby granted, free of charge, to any person obtaining a copy 11 11 * of this software and associated documentation files (the "Software"), to deal … … 14 14 * copies of the Software, and to permit persons to whom the Software is 15 15 * furnished to do so, subject to the following conditions: 16 * 16 * 17 17 * The above copyright notice and this permission notice shall be included in 18 18 * all copies or substantial portions of the Software. 19 * 19 * 20 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, … … 44 44 { 45 45 try { 46 /** @var int $bytes */ 46 47 $bytes = RandomCompat_intval($bytes); 47 48 } catch (TypeError $ex) { … … 61 62 * generated in one invocation. 62 63 */ 64 /** @var string|bool $buf */ 63 65 if ($bytes > 2147483647) { 64 66 $buf = ''; … … 70 72 } 71 73 } else { 74 /** @var string|bool $buf */ 72 75 $buf = \Sodium\randombytes_buf($bytes); 73 76 } 74 77 75 if ( $buf !== false) {78 if (is_string($buf)) { 76 79 if (RandomCompat_strlen($buf) === $bytes) { 77 80 return $buf;
Note: See TracChangeset
for help on using the changeset viewer.