com php-src: Accept int parameter in the first place: ext/openssl/openssl.c
| From: | Christoph Michael Becker | Date: | Fri, 01 Nov 2019 18:15:48 +0000 |
| Subject: | com php-src: Accept int parameter in the first place: ext/openssl/openssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109165@lists.php.net to get a copy of this message | ||
Commit: 34defbb784e2eb44a6e1560dd98f77ab44214b86
Author: Christoph M. Becker <cmbecker69@gmx.de> Fri, 1 Nov 2019 17:25:27 +0100
Parents: f19950fea0ecf77a4d218075c8fcaefa3d986ac5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34defbb784e2eb44a6e1560dd98f77ab44214b86
Log:
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.
Changed paths:
M ext/openssl/openssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 94335fadf9b..9f59546650d 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1507,13 +1507,12 @@ PHP_FUNCTION(openssl_spki_new)
const char *spkac = "SPKAC=";
zend_long algo = OPENSSL_ALGO_MD5;
- zval *method = NULL;
zval * zpkey = NULL;
EVP_PKEY * pkey = NULL;
NETSCAPE_SPKI *spki=NULL;
const EVP_MD *mdtype;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|z", &zpkey, &challenge,
&challenge_len, &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &zpkey, &challenge,
&challenge_len, &algo) == FAILURE) {
return;
}
RETVAL_FALSE;
@@ -1528,14 +1527,6 @@ PHP_FUNCTION(openssl_spki_new)
goto cleanup;
}
- if (method != NULL) {
- if (Z_TYPE_P(method) == IS_LONG) {
- algo = Z_LVAL_P(method);
- } else {
- php_error_docref(NULL, E_WARNING, "Algorithm must be of supported type");
- goto cleanup;
- }
- }
mdtype = php_openssl_get_evp_md_from_algo(algo);
if (!mdtype) {