[BUGFIX] IconFactory check arrays for key 71/50971/3
authorAlexander Opitz <opitz.alexander@googlemail.com>
Thu, 15 Dec 2016 10:47:25 +0000 (11:47 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 9 Jan 2017 17:04:06 +0000 (18:04 +0100)
This reduces PHP notices, as we check arrays before acessing them.

Resolves: #78992
Releases: master, 7.6
Change-Id: Ib0fc72be9e7957a27990d60dde844068ca9e24d1
Reviewed-on: https://review.typo3.org/50971
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/Imaging/IconFactory.php

index 69b8512..98a870a 100644 (file)
@@ -201,7 +201,9 @@ class IconFactory
                     }
                 }
             }
-            if (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
+            if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])
+                && is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])
+            ) {
                 foreach ($recordType as $key => $type) {
                     if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$type])) {
                         $recordType[$key] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$type];
@@ -232,7 +234,9 @@ class IconFactory
                 unset($type);
                 $recordType[0] = 'tcarecords-' . $table . '-default';
             }
-        } elseif (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
+        } elseif (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])
+            && is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])
+        ) {
             $recordType[0] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
         } else {
             $recordType[0] = 'tcarecords-' . $table . '-default';
@@ -269,10 +273,10 @@ class IconFactory
             'fe_group' => false,
             'deleted' => false,
             'protectedSection' => false,
-            'nav_hide' => (bool)$row['nav_hide']
+            'nav_hide' => !empty($row['nav_hide']),
         ];
         // Icon state based on "enableFields":
-        if (is_array($tcaCtrl['enablecolumns'])) {
+        if (isset($tcaCtrl['enablecolumns']) && is_array($tcaCtrl['enablecolumns'])) {
             $enableColumns = $tcaCtrl['enablecolumns'];
             // If "hidden" is enabled:
             if (isset($enableColumns['disabled']) && !empty($row[$enableColumns['disabled']])) {