From b0fbfa87b630f9ae5ed066f3a4a9d9e498f80252 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Thu, 23 Aug 2018 15:43:49 +0200 Subject: [PATCH] [BUGFIX] Use runtime cache for getIndpEnv() for results which are NULL isset() returns FALSE if a cached result is NULL. Use array_key_exists() instead. Resolves: #85946 Related: #69173 Releases: master, 8.7 Change-Id: I32bf695f7778213bacc51ed569250466685f1dac Reviewed-on: https://review.typo3.org/58006 Tested-by: TYPO3com Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- .../TypoScript/ConditionMatching/ConditionMatcherTest.php | 1 + typo3/sysext/core/Classes/Utility/GeneralUtility.php | 2 +- .../TypoScript/ConditionMatching/ConditionMatcherTest.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php index 07a07df14d23..9656d120c58f 100644 --- a/typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php +++ b/typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php @@ -787,6 +787,7 @@ public function genericGetVariablesSucceedsWithNamespaceENV() public function genericGetVariablesSucceedsWithNamespaceIENV() { $_SERVER['HTTP_HOST'] = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') . ':1234567'; + GeneralUtility::flushInternalRuntimeCaches(); $this->assertTrue($this->matchCondition->match('[globalString = IENV:TYPO3_PORT = 1234567]')); } diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 93a3b56a997f..fbe1de061d4c 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2816,7 +2816,7 @@ public static function linkThisUrl($url, array $getParams = []) */ public static function getIndpEnv($getEnvName) { - if (isset(self::$indpEnvCache[$getEnvName])) { + if (array_key_exists($getEnvName, self::$indpEnvCache)) { return self::$indpEnvCache[$getEnvName]; } diff --git a/typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php index fcab7ffd9f46..6ff1daea6efb 100644 --- a/typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php @@ -638,6 +638,7 @@ public function genericGetVariablesSucceedsWithNamespaceENV() public function genericGetVariablesSucceedsWithNamespaceIENV() { $_SERVER['HTTP_HOST'] = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') . ':1234567'; + GeneralUtility::flushInternalRuntimeCaches(); $this->assertTrue($this->matchCondition->match('[globalString = IENV:TYPO3_PORT = 1234567]')); }