MDL-74394 mnet: Better check for openssl_get_publickey() failure

In PHP8, this func now returns an object of type OpenSSLAsymmetricKey, not a
resource.

Reference:
https://www.php.net/manual/en/function.openssl-pkey-get-public.php
This commit is contained in:
Adam Olley
2022-04-01 14:32:50 +10:30
parent 7ce003b666
commit c24922fb40
+1 -1
View File
@@ -259,7 +259,7 @@ function mnet_encrypt_message($message, $remote_certificate) {
// Generate a key resource from the remote_certificate text string
$publickey = openssl_get_publickey($remote_certificate);
if ( gettype($publickey) != 'resource' ) {
if ($publickey === false) {
// Remote certificate is faulty.
return false;
}