Skip to content

Commit

Permalink
[Security] added an exception when the BCrypt encoder cannot be used …
Browse files Browse the repository at this point in the history
…(refs #7853)
  • Loading branch information
fabpot committed Apr 26, 2013
1 parent d59ffc9 commit aae9afb
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down

0 comments on commit aae9afb

Please sign in to comment.