]> git.mxchange.org Git - friendica.git/commitdiff
Fix further notes and warnings
authorMichael Vogel <icarus@dabo.de>
Tue, 19 Nov 2019 10:02:35 +0000 (11:02 +0100)
committerMichael Vogel <icarus@dabo.de>
Tue, 19 Nov 2019 10:02:35 +0000 (11:02 +0100)
src/Model/GServer.php
src/Protocol/ActivityPub/Transmitter.php

index 074e1b61304540f186deb08af30417d20a4e52fb..43aa92f33eec96abf4164f424eed5cd2732189b4 100644 (file)
@@ -1061,12 +1061,12 @@ class GServer
                        $attr = [];
                        if ($node->attributes->length) {
                                foreach ($node->attributes as $attribute) {
-                                       $attribute->value = @trim($attribute->value);
-                                       if (empty($attribute->value)) {
+                                       $value = trim($attribute->value);
+                                       if (empty($value)) {
                                                continue;
                                        }
 
-                                       $attr[$attribute->name] = $attribute->value;
+                                       $attr[$attribute->name] = $value;
                                }
 
                                if (empty($attr['name']) || empty($attr['content'])) {
@@ -1117,12 +1117,12 @@ class GServer
                        $attr = [];
                        if ($node->attributes->length) {
                                foreach ($node->attributes as $attribute) {
-                                       $attribute->value = @trim($attribute->value);
-                                       if (empty($attribute->value)) {
+                                       $value = trim($attribute->value);
+                                       if (empty($value)) {
                                                continue;
                                        }
 
-                                       $attr[$attribute->name] = $attribute->value;
+                                       $attr[$attribute->name] = $value;
                                }
 
                                if (empty($attr['property']) || empty($attr['content'])) {
index 99c3503b2d3969b8733b49ab5259e240ef16f4c9..5d3094339cbf99f7afb863773de944ef9703d187 100644 (file)
@@ -653,6 +653,9 @@ class Transmitter
        public static function ItemArrayFromMail($mail_id)
        {
                $mail = DBA::selectFirst('mail', [], ['id' => $mail_id]);
+               if (!DBA::isResult($mail)) {
+                       return [];
+               }
 
                $reply = DBA::selectFirst('mail', ['uri'], ['parent-uri' => $mail['parent-uri'], 'reply' => false]);
 
@@ -1234,6 +1237,10 @@ class Transmitter
         */
        public static function createNote($item)
        {
+               if (empty($item)) {
+                       return [];
+               }
+
                if ($item['event-type'] == 'event') {
                        $type = 'Event';
                } elseif (!empty($item['title'])) {