You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Util/SecureRandom.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,17 @@
11
11
12
12
namespaceSymfony\Component\Security\Core\Util;
13
13
14
+
@trigger_error('The '.__NAMESPACE__.'\SecureRandom class is deprecated since 2.8 and will be removed in 3.0. Use the random_bytes function instead.', E_USER_DEPRECATED);
15
+
14
16
usePsr\Log\LoggerInterface;
15
17
16
18
/**
17
19
* A secure random number generator implementation.
18
20
*
19
21
* @author Fabien Potencier <fabien@symfony.com>
20
22
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
23
+
*
24
+
* @deprecated since 2.8, to be removed in 3.0. Use the random_bytes function instead
@@ -43,9 +47,9 @@ public function __construct($seedFile = null, LoggerInterface $logger = null)
43
47
$this->logger = $logger;
44
48
45
49
// determine whether to use OpenSSL
46
-
if (!function_exists('openssl_random_pseudo_bytes')) {
50
+
if (!function_exists('random_bytes') || !function_exists('openssl_random_pseudo_bytes')) {
47
51
if (null !== $this->logger) {
48
-
$this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
52
+
$this->logger->notice('It is recommended that you install the "paragonie/random_compat" library or enable the "openssl" extension for random number generation.');
49
53
}
50
54
$this->useOpenSsl = false;
51
55
} else {
@@ -58,6 +62,10 @@ public function __construct($seedFile = null, LoggerInterface $logger = null)
0 commit comments