Skip to content

Commit

Permalink
[BUGFIX] Use runtime cache for getIndpEnv() for results which are NULL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stucki authored and lolli42 committed Sep 2, 2018
1 parent b99e734 commit b0fbfa8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Expand Up @@ -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]'));
}

Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Utility/GeneralUtility.php
Expand Up @@ -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];
}

Expand Down
Expand Up @@ -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]'));
}

Expand Down

0 comments on commit b0fbfa8

Please sign in to comment.