From: Michael Date: Mon, 18 May 2020 02:58:08 +0000 (+0000) Subject: Fix warnings ("Divide by zero" and "key parameter is not a valid public key") X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=efb1c630fdb8ee191eb5316f0853b8fccaff09c3;p=friendica.git Fix warnings ("Divide by zero" and "key parameter is not a valid public key") --- diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 258f52523c..67dbe3b19a 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -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 = '' . $text . ''; } } diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index dd1f678d58..243550862b 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -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),