summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Ferrara <ircmaxell@gmail.com>2012-06-26 21:36:58 -0400
committerAnthony Ferrara <ircmaxell@gmail.com>2012-06-26 21:36:58 -0400
commitc0b037942110027d6048cdd54bc7bb92dcb0f262 (patch)
treefca2bb11d598ca3d83e63feecf5bab89dbcb5b8a
parentff93b988b5ba5da638a41612cbd5bde1664aec20 (diff)
downloadpassword_compat-c0b037942110027d6048cdd54bc7bb92dcb0f262.zip
password_compat-c0b037942110027d6048cdd54bc7bb92dcb0f262.tar.gz
password_compat-c0b037942110027d6048cdd54bc7bb92dcb0f262.tar.bz2
Update the compat layer to use the php.ini settings instead of the constant
-rw-r--r--lib/password.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/password.php b/lib/password.php
index 6eb4665..8137a35 100644
--- a/lib/password.php
+++ b/lib/password.php
@@ -4,7 +4,7 @@ defined('PASSWORD_BCRYPT') or define('PASSWORD_BCRYPT', '2y');
defined('PASSWORD_DEFAULT') or define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
-define('PASSWORD_BCRYPT_DEFAULT_COST', 11);
+ini_get('password.bcrypt_cost') or ini_set('password.bcrypt_cost', '11');
if (!function_exists('password_hash')) {
function password_hash($password, $algo = PASSWORD_DEFAULT, $options = array()) {
@@ -21,7 +21,7 @@ if (!function_exists('password_hash')) {
}
switch ($algo) {
case PASSWORD_BCRYPT:
- $cost = PASSWORD_BCRYPT_DEFAULT_COST;
+ $cost = (int) ini_get('password.bcrypt_cost');
if (isset($options['cost'])) {
$cost = $options['cost'];
if ($cost < 4 || $cost > 31) {