From b6fa739ee433930cca175b1cd00606c2836b1327 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 17 Mar 2023 10:46:12 -0600 Subject: [PATCH] Home: Avoid "Illegal offset type" with default favorites from 21.1 --- home/inc/class.home_favorite_portlet.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/home/inc/class.home_favorite_portlet.inc.php b/home/inc/class.home_favorite_portlet.inc.php index 3a2ff1361c..e639d06ff9 100644 --- a/home/inc/class.home_favorite_portlet.inc.php +++ b/home/inc/class.home_favorite_portlet.inc.php @@ -90,13 +90,14 @@ class home_favorite_portlet extends home_portlet $favorites = Framework\Favorites::get_favorites($context['appname']); } - $this->favorite = (array)$favorites[$context['favorite'] ?: 'blank']; + $this->favorite = is_array($context['favorite']) ? $context['favorite'] : + (array)$favorites[$context['favorite'] ?: 'blank']; $this->title = lang($context['appname']) . ': ' . $this->favorite['name']; $this->context = $context; if($this->favorite) { $this->nm_settings['favorite'] = $this->context['favorite']; - if(is_array($favorites[$context['favorite']]['state'])) + if(is_string($context['favorite']) && is_array($favorites[$context['favorite']]['state'])) { $this->nm_settings += $this->favorite['state']; }