[BUGFIX] Use runtime cache for getIndpEnv() for results which are NULL 06/58006/4
authorMichael Stucki <michael.stucki@typo3.org>
Thu, 23 Aug 2018 13:43:49 +0000 (15:43 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 2 Sep 2018 13:33:13 +0000 (15:33 +0200)
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 <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php

index 07a07df..9656d12 100644 (file)
@@ -787,6 +787,7 @@ class ConditionMatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
     public function genericGetVariablesSucceedsWithNamespaceIENV()
     {
         $_SERVER['HTTP_HOST'] = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') . ':1234567';
+        GeneralUtility::flushInternalRuntimeCaches();
         $this->assertTrue($this->matchCondition->match('[globalString = IENV:TYPO3_PORT = 1234567]'));
     }
 
index 93a3b56..fbe1de0 100644 (file)
@@ -2816,7 +2816,7 @@ class GeneralUtility
      */
     public static function getIndpEnv($getEnvName)
     {
-        if (isset(self::$indpEnvCache[$getEnvName])) {
+        if (array_key_exists($getEnvName, self::$indpEnvCache)) {
             return self::$indpEnvCache[$getEnvName];
         }
 
index fcab7ff..6ff1dae 100644 (file)
@@ -638,6 +638,7 @@ class ConditionMatcherTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
     public function genericGetVariablesSucceedsWithNamespaceIENV()
     {
         $_SERVER['HTTP_HOST'] = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') . ':1234567';
+        GeneralUtility::flushInternalRuntimeCaches();
         $this->assertTrue($this->matchCondition->match('[globalString = IENV:TYPO3_PORT = 1234567]'));
     }