]> git.mxchange.org Git - friendica.git/commitdiff
Ward against empty string in Model\Item::replacePlatformIcon
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 26 Jan 2025 16:32:41 +0000 (11:32 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 26 Jan 2025 19:49:00 +0000 (14:49 -0500)
- Add logger call to troubleshoot

src/Model/Item.php

index 10fc41cc23b25c4bc318d5c6a6cab0834cc8a8cb..00435e2d4d66d865c01fe444602e869eb629e37f 100644 (file)
@@ -3498,6 +3498,10 @@ class Item
                }
 
                if (!empty($shared_item['uri-id'])) {
+                       if (!$s) {
+                               DI::logger()->notice('Unexpected empty item HTML', ['item' => $item]);
+                       }
+
                        $s = self::replacePlatformIcon($s, $shared_item, $uid);
                }
 
@@ -3574,6 +3578,10 @@ class Item
         */
        private static function replacePlatformIcon(string $html, array $item, int $uid): string
        {
+               if ($html === '') {
+                       return $html;
+               }
+
                $dom = new \DOMDocument();
                if (!@$dom->loadHTML($html)) {
                        return $html;