Page MenuHomePhabricator

D19726.id47136.diff
No OneTemporary

D19726.id47136.diff

Index: src/filesystem/Filesystem.php
===================================================================
--- src/filesystem/Filesystem.php
+++ src/filesystem/Filesystem.php
@@ -421,6 +421,12 @@
throw new Exception(pht('You must generate at least 1 byte of entropy.'));
}
+ // Under PHP7, the "random_bytes()" function provides a simpler and more
+ // portable way to accomplish what the rest of this function accomplishes.
+ if (function_exists('random_bytes')) {
+ return random_bytes($number_of_bytes);
+ }
+
// Try to use `openssl_random_pseudo_bytes()` if it's available. This source
// is the most widely available source, and works on Windows/Linux/OSX/etc.
@@ -481,9 +487,8 @@
pht(
'%s requires the PHP OpenSSL extension to be installed and enabled '.
'to access an entropy source. On Windows, this extension is usually '.
- 'installed but not enabled by default. Enable it in your "s".',
- __METHOD__.'()',
- 'php.ini'));
+ 'installed but not enabled by default. Enable it in your "php.ini".',
+ __METHOD__.'()'));
}
throw new Exception(

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 5:55 AM (3 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706198
Default Alt Text
D19726.id47136.diff (1 KB)

Event Timeline