summaryrefslogtreecommitdiffstats
path: root/Core/Encoder
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-04-26 11:43:22 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2013-04-26 11:43:25 +0200
commitb1f9472178bd3649dd221d5c84a95eda6a41cc9b (patch)
tree3586c004cd9c438e42313420bff48a0531725890 /Core/Encoder
parent653c9c84bc3d419128cabb5ec4d13419357648d8 (diff)
downloadsymfony-security-b1f9472178bd3649dd221d5c84a95eda6a41cc9b.zip
symfony-security-b1f9472178bd3649dd221d5c84a95eda6a41cc9b.tar.gz
symfony-security-b1f9472178bd3649dd221d5c84a95eda6a41cc9b.tar.bz2
[Security] added an exception when the BCrypt encoder cannot be used (refs #7853)
Diffstat (limited to 'Core/Encoder')
-rw-r--r--Core/Encoder/BCryptPasswordEncoder.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/Core/Encoder/BCryptPasswordEncoder.php b/Core/Encoder/BCryptPasswordEncoder.php
index 6a65fa5..2789444 100644
--- a/Core/Encoder/BCryptPasswordEncoder.php
+++ b/Core/Encoder/BCryptPasswordEncoder.php
@@ -33,6 +33,10 @@ class BCryptPasswordEncoder extends BasePasswordEncoder
*/
public function __construct($cost)
{
+ if (!function_exists('password_hash')) {
+ throw new \RuntimeException('To use the BCrypt encoder, you need to upgrade to PHP 5.5 or install the "ircmaxell/password-compat" via Composer.');
+ }
+
$cost = (int) $cost;
if ($cost < 4 || $cost > 31) {
throw new \InvalidArgumentException('Cost must be in the range of 4-31.');