From 20ab8de06d291169e037c709b71837ea9a9d205b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 26 Jan 2025 11:32:41 -0500 Subject: [PATCH] Ward against empty string in Model\Item::replacePlatformIcon - Add logger call to troubleshoot --- src/Model/Item.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Model/Item.php b/src/Model/Item.php index 10fc41cc23..00435e2d4d 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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;