1
0
Fork 0

Merge pull request #9124 from johnstevenson/deprecation

Fix openssl_free_key deprecation notice in PHP 8
pull/9170/head
Jordi Boggiano 2020-08-22 11:54:35 +02:00 committed by GitHub
commit c5f6413142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -271,7 +271,12 @@ TAGSPUBKEY
$signature = json_decode($signature, true);
$signature = base64_decode($signature['sha384']);
$verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
openssl_free_key($pubkeyid);
// PHP 8 automatically frees the key instance and deprecates the function
if (PHP_VERSION_ID < 80000) {
openssl_free_key($pubkeyid);
}
if (!$verified) {
throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
}