TheDJ has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/353026 )
Change subject: CryptRand: only use random_bytes on php 7 and later
......................................................................
CryptRand: only use random_bytes on php 7 and later
This avoids random_bytes polyfills used on older versions of PHP.
Bug: T143788
Change-Id: Ic9e511ccc043d50e0a9051cdfe069c27e4f4c339
---
M includes/libs/CryptRand.php
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/26/353026/1
diff --git a/includes/libs/CryptRand.php b/includes/libs/CryptRand.php
index 0d3613a..3bcc96f 100644
--- a/includes/libs/CryptRand.php
+++ b/includes/libs/CryptRand.php
@@ -247,8 +247,9 @@
// On Linux, getrandom syscall will be used if
available.
// On Windows CryptGenRandom will always be used
// On other platforms, /dev/urandom will be used.
+ // Avoids polyfills from before php 7.0
// All error situations will throw Exceptions and or
Errors
- if ( function_exists( 'random_bytes' ) ) {
+ if ( PHP_VERSION_ID >= 70000 && function_exists(
'random_bytes' ) ) {
$rem = $bytes - strlen( $buffer );
$buffer .= random_bytes( $rem );
}
--
To view, visit https://gerrit.wikimedia.org/r/353026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9e511ccc043d50e0a9051cdfe069c27e4f4c339
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits