Skip to content

Commit 1f6b7ed

Browse files
author
Pascal Querner
committed
feat?: backend: do not log on invalid stores - creates infinite loop
1 parent f1899b4 commit 1f6b7ed

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
@@ -57,6 +57,10 @@ class Mage_Core_Helper_EnvironmentConfigLoader extends Mage_Core_Helper_Abstract
5757
*/
5858
public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
5959
{
60+
$data = Mage::registry('current_env_config');
61+
if ($data) {
62+
return;
63+
}
6064
$env = $this->getEnv();
6165

6266
foreach ($env as $configKey => $value) {
@@ -78,7 +82,7 @@ public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
7882
$this->setCache($store, $value, $path);
7983
}
8084
} catch (Throwable $exception) {
81-
Mage::logException($exception);
85+
// invalid store, intentionally empty
8286
}
8387
break;
8488

@@ -98,15 +102,20 @@ public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
98102
}
99103
}
100104
} catch (Throwable $exception) {
101-
Mage::logException($exception);
105+
// invalid store, intentionally empty
102106
}
103107
break;
104108
}
105109
}
110+
Mage::register("current_env_config", true, true);
106111
}
107112

108113
public function hasPath(string $wantedPath): bool
109114
{
115+
$data = Mage::registry("config_env_has_path_$wantedPath");
116+
if ($data !== null) {
117+
return $data;
118+
}
110119
$env = $this->getEnv();
111120
$config = [];
112121

@@ -134,11 +143,17 @@ public function hasPath(string $wantedPath): bool
134143
break;
135144
}
136145
}
137-
return array_key_exists($wantedPath, $config);
146+
$hasConfig = array_key_exists($wantedPath, $config);
147+
Mage::register("config_env_has_path_$wantedPath", $hasConfig);
148+
return $hasConfig;
138149
}
139150

140151
public function getAsArray(string $wantedScope): array
141152
{
153+
$data = Mage::registry("config_env_array_$wantedScope");
154+
if ($data !== null) {
155+
return $data;
156+
}
142157
$env = $this->getEnv();
143158
$config = [];
144159

@@ -167,7 +182,7 @@ public function getAsArray(string $wantedScope): array
167182
break;
168183
}
169184
}
170-
185+
Mage::register("config_env_array_$wantedScope", $config);
171186
return $config;
172187
}
173188

0 commit comments

Comments
 (0)