Address some PHP 8.1 deprecation notices

- Replace a strstr call by strpos in Model\APContact
- Simplify conditions in Protocol\DFRN
- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1331012289
This commit is contained in:
Hypolite Petovan 2022-11-29 19:31:16 -05:00
parent 6c2f42ed03
commit 150c0e0750
3 changed files with 7 additions and 6 deletions

View file

@ -305,8 +305,8 @@ class APContact
$apcontact['pubkey'] = null;
if (!empty($compacted['w3id:publicKey'])) {
$apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value'));
if (strstr($apcontact['pubkey'], 'RSA ')) {
$apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value') ?? '');
if (strpos($apcontact['pubkey'], 'RSA ') !== false) {
$apcontact['pubkey'] = Crypto::rsaToPem($apcontact['pubkey']);
}
}