summaryrefslogtreecommitdiffstats
path: root/Core/Encoder/BCryptPasswordEncoder.php
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Encoder/BCryptPasswordEncoder.php')
-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.');