Skip to content

Commit 904415d

Browse files
author
Pascal Querner
committed
feat?: backend: do not log on invalid stores - creates infinite loop
1 parent 2d43630 commit 904415d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class Mage_Core_Helper_EnvironmentConfigLoader extends Mage_Core_Helper_Abstract
5050
*/
5151
public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
5252
{
53+
$data = Mage::registry('current_env_config');
54+
if ($data) {
55+
return;
56+
}
5357
$env = $this->getEnv();
5458

5559
foreach ($env as $configKey => $value) {
@@ -71,7 +75,7 @@ public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
7175
$this->setCache($store, $value, $path);
7276
}
7377
} catch (Throwable $exception) {
74-
Mage::logException($exception);
78+
// invalid store, intentionally empty
7579
}
7680
break;
7781

@@ -91,15 +95,20 @@ public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
9195
}
9296
}
9397
} catch (Throwable $exception) {
94-
Mage::logException($exception);
98+
// invalid store, intentionally empty
9599
}
96100
break;
97101
}
98102
}
103+
Mage::register("current_env_config", true, true);
99104
}
100105

101106
public function hasPath(string $wantedPath): bool
102107
{
108+
$data = Mage::registry("config_env_has_path_$wantedPath");
109+
if ($data !== null) {
110+
return $data;
111+
}
103112
$env = $this->getEnv();
104113
$config = [];
105114

@@ -127,11 +136,17 @@ public function hasPath(string $wantedPath): bool
127136
break;
128137
}
129138
}
130-
return array_key_exists($wantedPath, $config);
139+
$hasConfig = array_key_exists($wantedPath, $config);
140+
Mage::register("config_env_has_path_$wantedPath", $hasConfig);
141+
return $hasConfig;
131142
}
132143

133144
public function getAsArray(string $wantedScope): array
134145
{
146+
$data = Mage::registry("config_env_array_$wantedScope");
147+
if ($data !== null) {
148+
return $data;
149+
}
135150
$env = $this->getEnv();
136151
$config = [];
137152

@@ -160,7 +175,7 @@ public function getAsArray(string $wantedScope): array
160175
break;
161176
}
162177
}
163-
178+
Mage::register("config_env_array_$wantedScope", $config);
164179
return $config;
165180
}
166181

0 commit comments

Comments
 (0)