Skip to content

Commit 34defbb

Browse files
committed
Accept int parameter in the first place
This is more liberal then before, where that parameter (if given) had to be IS_LONG, while now it would be converted to int according to weak typing rules. This is, however, more what a developer would expect.
1 parent f19950f commit 34defbb

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

ext/openssl/openssl.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,13 +1507,12 @@ PHP_FUNCTION(openssl_spki_new)
15071507
const char *spkac = "SPKAC=";
15081508
zend_long algo = OPENSSL_ALGO_MD5;
15091509

1510-
zval *method = NULL;
15111510
zval * zpkey = NULL;
15121511
EVP_PKEY * pkey = NULL;
15131512
NETSCAPE_SPKI *spki=NULL;
15141513
const EVP_MD *mdtype;
15151514

1516-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|z", &zpkey, &challenge, &challenge_len, &method) == FAILURE) {
1515+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &zpkey, &challenge, &challenge_len, &algo) == FAILURE) {
15171516
return;
15181517
}
15191518
RETVAL_FALSE;
@@ -1528,14 +1527,6 @@ PHP_FUNCTION(openssl_spki_new)
15281527
goto cleanup;
15291528
}
15301529

1531-
if (method != NULL) {
1532-
if (Z_TYPE_P(method) == IS_LONG) {
1533-
algo = Z_LVAL_P(method);
1534-
} else {
1535-
php_error_docref(NULL, E_WARNING, "Algorithm must be of supported type");
1536-
goto cleanup;
1537-
}
1538-
}
15391530
mdtype = php_openssl_get_evp_md_from_algo(algo);
15401531

15411532
if (!mdtype) {

0 commit comments

Comments
 (0)