Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15392047
D19726.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D19726.id.diff
View Options
diff --git a/src/filesystem/Filesystem.php b/src/filesystem/Filesystem.php
--- a/src/filesystem/Filesystem.php
+++ b/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
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 1:00 PM (2 d, 18 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7578488
Default Alt Text
D19726.id.diff (1 KB)
Attached To
Mode
D19726: [Wilds] Use "random_bytes()" if it is available (after PHP7)
Attached
Detach File
Event Timeline
Log In to Comment