]> git.mxchange.org Git - friendica.git/commitdiff
Fix warnings ("Divide by zero" and "key parameter is not a valid public key")
authorMichael <heluecht@pirati.ca>
Mon, 18 May 2020 02:58:08 +0000 (02:58 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 18 May 2020 02:58:08 +0000 (02:58 +0000)
src/Content/Text/BBCode.php
src/Protocol/Diaspora.php

index 258f52523c6ceccef1f3bae47f2b2ec72a5048e6..67dbe3b19aa05a3e347f0d9cb6c170a5e4e46425 100644 (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>';
                        }
                }
index dd1f678d58945a22f3651f9001ab04f845b7af3a..243550862be8e93010f310318a87856288619955 100644 (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),