Merge pull request #8656 from annando/warnings

Fix warnings ("Division by zero" and "key parameter is not a valid public key")
This commit is contained in:
Hypolite Petovan 2020-05-18 08:04:34 -04:00 committed by GitHub
commit 3810456c34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -1727,10 +1727,10 @@ class BBCode
$text = Smilies::replace($text);
}
if (DI::config()->get('system', 'big_emojis') && ($simple_html != self::DIASPORA)) {
if (!$for_plaintext && DI::config()->get('system', 'big_emojis') && ($simple_html != self::DIASPORA)) {
$conv = html_entity_decode(str_replace([' ', "\n", "\r"], '', $text));
// Emojis are always 4 byte Unicode characters
if (strlen($conv) / mb_strlen($conv) == 4) {
if (!empty($conv) && (strlen($conv) / mb_strlen($conv) == 4)) {
$text = '<span style="font-size: xx-large; line-height: initial;">' . $text . '</span>';
}
}

View file

@ -3139,7 +3139,9 @@ class Diaspora
$json = json_encode(["iv" => $b_iv, "key" => $b_aes_key]);
$encrypted_key_bundle = "";
openssl_public_encrypt($json, $encrypted_key_bundle, $pubkey);
if (!@openssl_public_encrypt($json, $encrypted_key_bundle, $pubkey)) {
return false;
}
$json_object = json_encode(
["aes_key" => base64_encode($encrypted_key_bundle),