- 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_com_dotnet.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 * 8 * Copyright (c) 2015 - 201 7Paragon Initiative Enterprises9 * 7 * 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, … … 42 42 { 43 43 try { 44 /** @var int $bytes */ 44 45 $bytes = RandomCompat_intval($bytes); 45 46 } catch (TypeError $ex) { … … 55 56 } 56 57 58 /** @var string $buf */ 57 59 $buf = ''; 58 60 if (!class_exists('COM')) { … … 61 63 ); 62 64 } 65 /** @var COM $util */ 63 66 $util = new COM('CAPICOM.Utilities.1'); 64 67 $execCount = 0; … … 69 72 */ 70 73 do { 71 $buf .= base64_decode( $util->GetRandom($bytes, 0));74 $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); 72 75 if (RandomCompat_strlen($buf) >= $bytes) { 73 76 /** 74 77 * Return our random entropy buffer here: 75 78 */ 76 return RandomCompat_substr($buf, 0, $bytes);79 return (string) RandomCompat_substr($buf, 0, $bytes); 77 80 } 78 81 ++$execCount;
Note: See TracChangeset
for help on using the changeset viewer.