Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix openssl_csr_export() signature #7866

Merged
merged 1 commit into from Apr 13, 2022
Merged

Fix openssl_csr_export() signature #7866

merged 1 commit into from Apr 13, 2022

Conversation

mpesari
Copy link
Contributor

@mpesari mpesari commented Apr 13, 2022

The documentation for openssl_csr_export() was updated recently, although it does not seem to be live yet.

This fixes the 2nd parameter $output of openssl_csr_export() signature in Psalm.

Example of what this should fix (there should be no errors): https://psalm.dev/r/03755de763

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/03755de763
<?php

declare(strict_types=1);

$private_key = openssl_pkey_new(array(
    "private_key_bits" => 2048,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
));

$csr = openssl_csr_new([], $private_key);

openssl_csr_export($csr, $output);

print gettype($output); // "string"

$test = new class {
    public string $pem = '';
};

$test->pem = $output;
Psalm output (using commit 916fddb):

ERROR: InvalidPropertyAssignmentValue - 20:14 - $test->pem with declared type 'string' cannot be assigned type 'OpenSSLAsymmetricKey'

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Apr 13, 2022
@orklah
Copy link
Collaborator

orklah commented Apr 13, 2022

Thanks!

@orklah orklah merged commit bbfcf02 into vimeo:4.x Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants