diff options
Diffstat (limited to 'ext/standard/password.c')
-rw-r--r-- | ext/standard/password.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/ext/standard/password.c b/ext/standard/password.c index 656dc50cbb..209e2533f8 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -231,16 +231,8 @@ PHP_FUNCTION(password_needs_rehash) { zend_long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0; - if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_LONG) { - zval cast_option_buffer; - ZVAL_DUP(&cast_option_buffer, option_buffer); - convert_to_long(&cast_option_buffer); - new_cost = Z_LVAL(cast_option_buffer); - zval_dtor(&cast_option_buffer); - } else { - new_cost = Z_LVAL_P(option_buffer); - } + if (options && (option_buffer = zend_hash_str_find(options, "cost", sizeof("cost")-1)) != NULL) { + new_cost = zval_get_long(option_buffer); } sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost); @@ -314,16 +306,8 @@ PHP_FUNCTION(password_hash) { zend_long cost = PHP_PASSWORD_BCRYPT_COST; - if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_LONG) { - zval cast_option_buffer; - ZVAL_DUP(&cast_option_buffer, option_buffer); - convert_to_long(&cast_option_buffer); - cost = Z_LVAL(cast_option_buffer); - zval_dtor(&cast_option_buffer); - } else { - cost = Z_LVAL_P(option_buffer); - } + if (options && (option_buffer = zend_hash_str_find(options, "cost", sizeof("cost")-1)) != NULL) { + cost = zval_get_long(option_buffer); } if (cost < 4 || cost > 31) { @@ -343,7 +327,7 @@ PHP_FUNCTION(password_hash) RETURN_NULL(); } - if (options && (option_buffer = zend_symtable_str_find(options, "salt", sizeof("salt")-1)) != NULL) { + if (options && (option_buffer = zend_hash_str_find(options, "salt", sizeof("salt")-1)) != NULL) { char *buffer; size_t buffer_len = 0; |