[BUGFIX] Make empty $GLOBALS['TBE_MODULES_EXT'] traversable 97/55297/3
authorRichard Haeser <richard@maxserv.com>
Fri, 5 Jan 2018 10:44:01 +0000 (11:44 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 8 Jan 2018 21:07:53 +0000 (22:07 +0100)
Prevent warnings and notices if $GLOBALS['TBE_MODULES_EXT'] is not
set, which can be the case if no extensions are installed.

Change-Id: I72f513329790ee3b71fd30054574b79f41a6dcf8
Resolves: #83479
Releases: master, 8.7, 7.6
Reviewed-on: https://review.typo3.org/55297
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php

index ea0a4d5..e697458 100644 (file)
@@ -191,23 +191,25 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function createMenuEntriesForTbeModulesExt()
     {
-        foreach ($GLOBALS['TBE_MODULES_EXT'] as $mainModule => $tbeModuleExt) {
-            list($main) = explode('_', $mainModule);
-            $mainEntry = $this->findByModuleName($main);
-            if ($mainEntry === false) {
-                continue;
-            }
+        if (isset($GLOBALS['TBE_MODULES_EXT'])) {
+            foreach ((array)$GLOBALS['TBE_MODULES_EXT'] as $mainModule => $tbeModuleExt) {
+                list($main) = explode('_', $mainModule);
+                $mainEntry = $this->findByModuleName($main);
+                if ($mainEntry === false) {
+                    continue;
+                }
 
-            $subEntries = $mainEntry->getChildren();
-            if (empty($subEntries)) {
-                continue;
-            }
-            $matchingSubEntry = $this->findByModuleName($mainModule);
-            if ($matchingSubEntry !== false) {
-                if (isset($tbeModuleExt['MOD_MENU']) && isset($tbeModuleExt['MOD_MENU']['function'])) {
-                    foreach ($tbeModuleExt['MOD_MENU']['function'] as $subModule) {
-                        $entry = $this->createEntryFromRawData($subModule);
-                        $matchingSubEntry->addChild($entry);
+                $subEntries = $mainEntry->getChildren();
+                if (empty($subEntries)) {
+                    continue;
+                }
+                $matchingSubEntry = $this->findByModuleName($mainModule);
+                if ($matchingSubEntry !== false) {
+                    if (isset($tbeModuleExt['MOD_MENU']) && isset($tbeModuleExt['MOD_MENU']['function'])) {
+                        foreach ($tbeModuleExt['MOD_MENU']['function'] as $subModule) {
+                            $entry = $this->createEntryFromRawData($subModule);
+                            $matchingSubEntry->addChild($entry);
+                        }
                     }
                 }
             }