summaryrefslogtreecommitdiff
path: root/ext/standard/password.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/password.c')
-rw-r--r--ext/standard/password.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/ext/standard/password.c b/ext/standard/password.c
index d362e6f7f3..c5b5fe2c98 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -173,9 +173,9 @@ PHP_FUNCTION(password_get_info)
char *hash, *algo_name;
zval options;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &hash, &hash_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(hash, hash_len)
+ ZEND_PARSE_PARAMETERS_END();
array_init(&options);
@@ -229,9 +229,12 @@ PHP_FUNCTION(password_needs_rehash)
HashTable *options = 0;
zval *option_buffer;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|H", &hash, &hash_len, &new_algo, &options) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(hash, hash_len)
+ Z_PARAM_LONG(new_algo)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY_OR_OBJECT_HT(options)
+ ZEND_PARSE_PARAMETERS_END();
algo = php_password_determine_algo(hash, (size_t) hash_len);
@@ -300,9 +303,10 @@ PHP_FUNCTION(password_verify)
zend_string *ret;
php_password_algo algo;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &password, &password_len, &hash, &hash_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STRING(password, password_len)
+ Z_PARAM_STRING(hash, hash_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
algo = php_password_determine_algo(hash, (size_t) hash_len);
@@ -372,9 +376,12 @@ PHP_FUNCTION(password_hash)
argon2_type type = Argon2_i;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|H", &password, &password_len, &algo, &options) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(password, password_len)
+ Z_PARAM_LONG(algo)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY_OR_OBJECT_HT(options)
+ ZEND_PARSE_PARAMETERS_END();
switch (algo) {
case PHP_PASSWORD_BCRYPT: