Merge pull request #6752 from MrPetovan/bug/notices
authorMichael Vogel <icarus@dabo.de>
Sun, 24 Feb 2019 20:30:07 +0000 (21:30 +0100)
committerGitHub <noreply@github.com>
Sun, 24 Feb 2019 20:30:07 +0000 (21:30 +0100)
Fix various notices

src/Model/Term.php
src/Protocol/DFRN.php
view/theme/frio/php/scheme.php

index 58c3223..ed67969 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Model;
 
+use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Util\Strings;
index e30f027..efd3c4a 100644 (file)
@@ -119,7 +119,9 @@ class DFRN
                        $item["entry:cid"] = defaults($item, "entry:cid", 0);
 
                        $entry = self::entry($doc, "text", $item, $owner, $item["entry:comment-allow"], $item["entry:cid"]);
-                       $root->appendChild($entry);
+                       if (isset($entry)) {
+                               $root->appendChild($entry);
+                       }
                }
 
                return trim($doc->saveXML());
@@ -323,7 +325,9 @@ class DFRN
                        }
 
                        $entry = self::entry($doc, $type, $item, $owner, true);
-                       $root->appendChild($entry);
+                       if (isset($entry)) {
+                               $root->appendChild($entry);
+                       }
                }
 
                $atom = trim($doc->saveXML());
@@ -390,7 +394,9 @@ class DFRN
 
                        foreach ($items as $item) {
                                $entry = self::entry($doc, $type, $item, $owner, true, 0);
-                               $root->appendChild($entry);
+                               if (isset($entry)) {
+                                       $root->appendChild($entry);
+                               }
                        }
                } else {
                        $root = self::entry($doc, $type, $item, $owner, true, 0, true);
@@ -908,7 +914,7 @@ class DFRN
         * @param int         $cid     Contact ID of the recipient
         * @param bool        $single  If set, the entry is created as an XML document with a single "entry" element
         *
-        * @return \DOMElement XML entry object
+        * @return null|\DOMElement XML entry object
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         * @todo  Find proper type-hints
@@ -918,7 +924,8 @@ class DFRN
                $mentioned = [];
 
                if (!$item['parent']) {
-                       return;
+                       Logger::notice('Item without parent found.', ['type' => $type, 'item' => $item]);
+                       return null;
                }
 
                if ($item['deleted']) {
index 2f09180..9e3f610 100644 (file)
  *    'version' => Scheme version
  *    'overwrites' => Variables which overwriting custom settings
  */
+
 use Friendica\Core\PConfig;
 
 function get_scheme_info($scheme)
 {
        $theme = \get_app()->getCurrentTheme();
        $themepath = 'view/theme/' . $theme . '/';
-       $scheme = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'scheme'));
+       if (empty($scheme)) {
+               $scheme = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'scheme'));
+       }
 
        $info = [
                'name' => $scheme,