Skip to content

Commit 39b2f92

Browse files
committed
Use proper type error
1 parent f85e607 commit 39b2f92

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ext/openssl/openssl.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -6558,8 +6558,9 @@ PHP_FUNCTION(openssl_sign)
65586558
} else if (Z_TYPE_P(method) == IS_STRING) {
65596559
mdtype = EVP_get_digestbyname(Z_STRVAL_P(method));
65606560
} else {
6561-
// Should be type error?
6562-
mdtype = NULL;
6561+
// TODO Use proper ZPP check.
6562+
zend_argument_type_error(4, "must be of type string|int|null, %s given" , zend_zval_type_name(method));
6563+
RETURN_THROWS();
65636564
}
65646565
if (!mdtype) {
65656566
zend_argument_value_error(4, "must be a valid signature algorithm");
@@ -6629,8 +6630,9 @@ PHP_FUNCTION(openssl_verify)
66296630
} else if (Z_TYPE_P(method) == IS_STRING) {
66306631
mdtype = EVP_get_digestbyname(Z_STRVAL_P(method));
66316632
} else {
6632-
/* Change to type error instead? */
6633-
mdtype = NULL;
6633+
// TODO Use proper ZPP check.
6634+
zend_argument_type_error(4, "must be of type string|int|null, %s given" , zend_zval_type_name(method));
6635+
RETURN_THROWS();
66346636
}
66356637
if (!mdtype) {
66366638
zend_argument_value_error(4, "must be a valid signature algorithm");

0 commit comments

Comments
 (0)