[Security] added an exception when the BCrypt encoder cannot be used (refs #7853)
This commit is contained in:
parent
d59ffc9aa2
commit
aae9afb6d8
|
@ -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.');
|
||||
|
|
Reference in New Issue