Skip to content

Commit

Permalink
Use proper type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Aug 4, 2020
1 parent f85e607 commit 39b2f92
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ext/openssl/openssl.c
Expand Up @@ -6558,8 +6558,9 @@ PHP_FUNCTION(openssl_sign)
} else if (Z_TYPE_P(method) == IS_STRING) {
mdtype = EVP_get_digestbyname(Z_STRVAL_P(method));
} else {
// Should be type error?
mdtype = NULL;
// TODO Use proper ZPP check.
zend_argument_type_error(4, "must be of type string|int|null, %s given" , zend_zval_type_name(method));
RETURN_THROWS();
}
if (!mdtype) {
zend_argument_value_error(4, "must be a valid signature algorithm");
Expand Down Expand Up @@ -6629,8 +6630,9 @@ PHP_FUNCTION(openssl_verify)
} else if (Z_TYPE_P(method) == IS_STRING) {
mdtype = EVP_get_digestbyname(Z_STRVAL_P(method));
} else {
/* Change to type error instead? */
mdtype = NULL;
// TODO Use proper ZPP check.
zend_argument_type_error(4, "must be of type string|int|null, %s given" , zend_zval_type_name(method));
RETURN_THROWS();
}
if (!mdtype) {
zend_argument_value_error(4, "must be a valid signature algorithm");
Expand Down

0 comments on commit 39b2f92

Please sign in to comment.