From c36f58af4d995a31f9947578c7e5f1a643ddc88a Mon Sep 17 00:00:00 2001 From: Ralf Merz Date: Tue, 8 May 2018 16:10:18 +0200 Subject: [PATCH] FIX | add some array checks to prevent exceptions. One on first install, second on opening module if an identifier is wrong. --- Classes/Controller/IconcheckController.php | 6 ++++-- .../Domain/Model/Dto/ExtensionConfiguration.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Classes/Controller/IconcheckController.php b/Classes/Controller/IconcheckController.php index 2257081..54303b1 100644 --- a/Classes/Controller/IconcheckController.php +++ b/Classes/Controller/IconcheckController.php @@ -95,8 +95,10 @@ public function indexAction() $iconsToShow[$string][] = $key; } } - // Sort icons - natcasesort($iconsToShow[$string]); + // Sort icons (only if it is an array) + if (is_array($iconsToShow[$string])) { + natcasesort($iconsToShow[$string]); + } } $this->view->assign('iconsToShow', $iconsToShow); } diff --git a/Classes/Domain/Model/Dto/ExtensionConfiguration.php b/Classes/Domain/Model/Dto/ExtensionConfiguration.php index a48d1c1..faff92e 100644 --- a/Classes/Domain/Model/Dto/ExtensionConfiguration.php +++ b/Classes/Domain/Model/Dto/ExtensionConfiguration.php @@ -21,11 +21,15 @@ class ExtensionConfiguration public function __construct() { - /** @noinspection UnserializeExploitsInspection */ - $settings = (array)unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['iconcheck']); - foreach ($settings as $key => $value) { - if (property_exists(__CLASS__, $key)) { - $this->$key = $value; + if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['iconcheck'] === null) { + $settings = []; + } else { + /** @noinspection UnserializeExploitsInspection */ + $settings = (array)unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['iconcheck']); + foreach ($settings as $key => $value) { + if (property_exists(__CLASS__, $key)) { + $this->$key = $value; + } } } }