Skip to content

Commit

Permalink
Fix types in openssl stub
Browse files Browse the repository at this point in the history
These two $recipcert parameters don't use proper union types
right now. They are a bit tricky due to the $recipkey -> $recipcert
fallback.
  • Loading branch information
nikic committed Aug 14, 2020
1 parent 64368f4 commit ca20f36
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 10 additions & 4 deletions ext/openssl/openssl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ function openssl_pkcs7_encrypt(string $infile, string $outfile, $recipcerts, ?ar
/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $signkey */
function openssl_pkcs7_sign(string $infile, string $outfile, OpenSSLCertificate|string $signcert, $signkey, ?array $headers, int $flags = PKCS7_DETACHED, ?string $extracertsfilename = null): bool {}

/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string|null $recipkey */
function openssl_pkcs7_decrypt(string $infilename, string $outfilename, OpenSSLCertificate|string $recipcert, $recipkey = null): bool {}
/**
* @param OpenSSLCertificate|string $recipcert
* @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string|null $recipkey
*/
function openssl_pkcs7_decrypt(string $infilename, string $outfilename, $recipcert, $recipkey = null): bool {}

/** @param array $certs */
function openssl_pkcs7_read(string $infilename, &$certs): bool {}
Expand All @@ -130,8 +133,11 @@ function openssl_cms_encrypt(string $infile, string $outfile, $recipcerts, ?arra
/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $signkey */
function openssl_cms_sign(string $infile, string $outfile, OpenSSLCertificate|string $signcert, $signkey, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, ?string $extracertsfilename = null): bool {}

/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $recipkey */
function openssl_cms_decrypt(string $infilename, string $outfilename, OpenSSLCertificate|string $recipcert, $recipkey, int $encoding = OPENSSL_ENCODING_SMIME): bool {}
/**
* @param OpenSSLCertificate|string $recipcert
* @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $recipkey
*/
function openssl_cms_decrypt(string $infilename, string $outfilename, $recipcert, $recipkey = UNKNOWN, int $encoding = OPENSSL_ENCODING_SMIME): bool {}

/** @param array $certs */
function openssl_cms_read(string $infilename, &$certs): bool {}
Expand Down
8 changes: 4 additions & 4 deletions ext/openssl/openssl_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: ed45da0e8786db9b20fd33d574b20f3d41304e0a */
* Stub hash: 10a514c9947313694296c6ec9ec6f2fa8e6c850b */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL)
Expand Down Expand Up @@ -190,7 +190,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_decrypt, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
ZEND_ARG_OBJ_TYPE_MASK(0, recipcert, OpenSSLCertificate, MAY_BE_STRING, NULL)
ZEND_ARG_INFO(0, recipcert)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, recipkey, "null")
ZEND_END_ARG_INFO()

Expand Down Expand Up @@ -232,10 +232,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_sign, 0, 5, _IS_BOOL
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extracertsfilename, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_decrypt, 0, 4, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_decrypt, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
ZEND_ARG_OBJ_TYPE_MASK(0, recipcert, OpenSSLCertificate, MAY_BE_STRING, NULL)
ZEND_ARG_INFO(0, recipcert)
ZEND_ARG_INFO(0, recipkey)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_LONG, 0, "OPENSSL_ENCODING_SMIME")
ZEND_END_ARG_INFO()
Expand Down

0 comments on commit ca20f36

Please sign in to comment.