From ee33fc2ee9efed4c74937b73ae65460425c84e3f Mon Sep 17 00:00:00 2001
From: Tymoteusz Motylewski <t.motylewski@gmail.com>
Date: Sat, 4 Nov 2017 21:05:16 +0100
Subject: [PATCH] [BUGFIX] Fix PHP Notices in cached ext_localconf.php

Resolves: #82920
Releases: master, 8.7
Change-Id: I7a533f56ec68a119c19aad6c87de9dfc2e59dc6a
Reviewed-on: https://review.typo3.org/54557
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
---
 .../core/Classes/Utility/ExtensionManagementUtility.php   | 8 ++++----
 .../install/Classes/Controller/UpgradeController.php      | 4 ++--
 typo3/sysext/install/Classes/Service/LoadTcaService.php   | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
index 02cfb2e77e3f..773f15b010a8 100644
--- a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
+++ b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
@@ -1524,7 +1524,7 @@ tt_content.' . $key . $suffix . ' {
             if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && isset($extensionInformation['ext_localconf.php'])) {
                 // $_EXTKEY and $_EXTCONF are available in ext_localconf.php
                 // and are explicitly set in cached file as well
-                $_EXTCONF = isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]) ? $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] : null;
+                $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] ?? null;
                 require $extensionInformation['ext_localconf.php'];
             }
         }
@@ -1555,7 +1555,7 @@ tt_content.' . $key . $suffix . ' {
                 $phpCodeToCache[] = '';
                 // Set $_EXTKEY and $_EXTCONF for this extension
                 $phpCodeToCache[] = '$_EXTKEY = \'' . $extensionKey . '\';';
-                $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
+                $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY] ?? null;';
                 $phpCodeToCache[] = '';
                 // Add ext_localconf.php content of extension
                 $phpCodeToCache[] = trim(file_get_contents($extensionDetails['ext_localconf.php']));
@@ -1777,7 +1777,7 @@ tt_content.' . $key . $suffix . ' {
             if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && $extensionInformation['ext_tables.php']) {
                 // $_EXTKEY and $_EXTCONF are available in ext_tables.php
                 // and are explicitly set in cached file as well
-                $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+                $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] ?? null;
                 require $extensionInformation['ext_tables.php'];
             }
         }
@@ -1811,7 +1811,7 @@ tt_content.' . $key . $suffix . ' {
                 $phpCodeToCache[] = '';
                 // Set $_EXTKEY and $_EXTCONF for this extension
                 $phpCodeToCache[] = '$_EXTKEY = \'' . $extensionKey . '\';';
-                $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
+                $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY] ?? null;';
                 $phpCodeToCache[] = '';
                 // Add ext_tables.php content of extension
                 $phpCodeToCache[] = trim(file_get_contents($extensionDetails['ext_tables.php']));
diff --git a/typo3/sysext/install/Classes/Controller/UpgradeController.php b/typo3/sysext/install/Classes/Controller/UpgradeController.php
index d40438c0dc00..6031f2d872f1 100644
--- a/typo3/sysext/install/Classes/Controller/UpgradeController.php
+++ b/typo3/sysext/install/Classes/Controller/UpgradeController.php
@@ -1032,7 +1032,7 @@ class UpgradeController extends AbstractController
         if (isset($extension['ext_localconf.php']) && $extension['ext_localconf.php']) {
             // $_EXTKEY and $_EXTCONF are available in ext_localconf.php
             // and are explicitly set in cached file as well
-            $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+            $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] ?? null;
             require $extension['ext_localconf.php'];
         }
     }
@@ -1057,7 +1057,7 @@ class UpgradeController extends AbstractController
         if (isset($extension['ext_tables.php']) && $extension['ext_tables.php']) {
             // $_EXTKEY and $_EXTCONF are available in ext_tables.php
             // and are explicitly set in cached file as well
-            $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+            $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] ?? null;
             require $extension['ext_tables.php'];
         }
     }
diff --git a/typo3/sysext/install/Classes/Service/LoadTcaService.php b/typo3/sysext/install/Classes/Service/LoadTcaService.php
index abeed1a6b767..37ebe8a60a23 100644
--- a/typo3/sysext/install/Classes/Service/LoadTcaService.php
+++ b/typo3/sysext/install/Classes/Service/LoadTcaService.php
@@ -108,7 +108,7 @@ class LoadTcaService
         ) {
             // $_EXTKEY and $_EXTCONF are available in ext_tables.php
             // and are explicitly set in cached file as well
-            $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+            $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] ?? null;
             require $extensionInformation['ext_tables.php'];
         }
     }
-- 
GitLab