Skip to content

Conversation

h3xx
Copy link
Contributor

@h3xx h3xx commented Jun 10, 2023

This updates and fixes definitions for all the OpenSSL-related built-in functions.
"Why not all built-in functions?" you ask. Well I didn't want to overwhelm review and create a huge PR. :-)

Fixed the parameter names to match the documentation (this is to aid users of PHP 8's named parameters).

Use class names as types instead of "resource" where appropriate; in cases where it was two or more types, it was left as "mixed".

Fix incorrect signature for openssl_pkcs7_encrypt.

Minor fixes to return type; true/false/-1 on error => bool.

Function support added:

This updates and fixes definitions for many OpenSSL-related built-in
functions.

Fixed the parameter names to match the documentation (this is to aid
users of PHP 8's named parameters).

Use class names as types instead of "resource" where appropriate; in
cases where it was two or more types, it was left as "mixed".

Fix incorrect signature for `openssl_pkcs7_encrypt`.

Minor fixes to return type; true/false/-1 on error => bool.

Function support added:

* [openssl\_cipher\_key\_length](https://www.php.net/manual/en/function.openssl-cipher-key-length.php) (added in PHP 8.2.0)
* [openssl\_cms\_decrypt](https://www.php.net/manual/en/function.openssl-cms-decrypt.php) (added in PHP 8)
* [openssl\_cms\_encrypt](https://www.php.net/manual/en/function.openssl-cms-encrypt.php) (added in PHP 8)
* [openssl\_cms\_sign](https://www.php.net/manual/en/function.openssl-cms-sign.php) (added in PHP 8)
* [openssl\_cms\_verify](https://www.php.net/manual/en/function.openssl-cms-verify.php) (added in PHP 8)
* [openssl\_pkey\_derive](https://www.php.net/manual/en/function.openssl-pkey-derive.php) (added in PHP 7.3.0)
* [openssl\_x509\_verify](https://www.php.net/manual/en/function.openssl-x509-verify.php) (added in PHP 7.4.0)
@h3xx h3xx force-pushed the fix-openssl-declarations branch from 32dc21c to 1b18bcb Compare June 10, 2023 17:33
@complex857
Copy link
Collaborator

Hi @h3xx, thank you for the submission, I'm going to merge it.

Granted it's been a while I updated the built-in definitions dicts. It generates different content to what you've on your branch on the methods you were updating.
(I also need to update the code to deal with these new nullable ? markers in front of parameters)

For example:

-\ 'openssl_pkcs7_encrypt(': 'string $input_filename, string $output_filename, mixed $certificate, array $headers [, int $flags = 0 [, int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC]] | bool',
+\ 'openssl_pkcs7_encrypt(': 'string $input_filename, string $output_filename, OpenSSLCertificate|array|string $certificate, ?array $headers [, int $flags = 0 [, int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC]] | bool',

Do you mind if I overwrite these to what the generator spits out after?

P.S.: Never worry about sending in huge diffs 😄

@complex857 complex857 merged commit 1b18bcb into shawncplus:master Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants