From f8a212817da836bf7da3812fae8b6efe8f65e4e4 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 12 Mar 2020 12:38:10 +1300 Subject: [PATCH] Fix fatal error on loading extension page when an extension has been deleted Since we added the concept of 'hidden' tags we are loading them in a way where the exceptions are not caught. This means that the whole page cannot load - which is needed to disable the missing extension --- CRM/Extension/Mapper.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CRM/Extension/Mapper.php b/CRM/Extension/Mapper.php index c86226cba1..ce50f74495 100644 --- a/CRM/Extension/Mapper.php +++ b/CRM/Extension/Mapper.php @@ -171,10 +171,11 @@ class CRM_Extension_Mapper { } catch (CRM_Extension_Exception $e) { // file has more detailed info, but we'll fallback to DB if it's missing -- DB has enough info to uninstall - $this->infos[$key] = CRM_Extension_System::singleton()->getManager()->createInfoFromDB($key); - if (!$this->infos[$key]) { + $dbInfo = CRM_Extension_System::singleton()->getManager()->createInfoFromDB($key); + if (!$dbInfo) { throw $e; } + $this->infos[$key] = $dbInfo; } } return $this->infos[$key]; @@ -441,7 +442,16 @@ class CRM_Extension_Mapper { */ public function getAllInfos() { foreach ($this->container->getKeys() as $key) { - $this->keyToInfo($key); + try { + $this->keyToInfo($key); + } + catch (CRM_Extension_Exception_ParseException $e) { + CRM_Core_Session::setStatus(ts('Parse error in extension: %1', [ + 1 => $e->getMessage(), + ]), '', 'error'); + CRM_Core_Error::debug_log_message("Parse error in extension: " . $e->getMessage()); + continue; + } } return $this->infos; } -- 2.25.1