Skip to content

Commit f72e25f

Browse files
ISS-33802: revert backward incompatible changes
1 parent d0191e7 commit f72e25f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

lib/internal/Magento/Framework/App/DeploymentConfig.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ class DeploymentConfig
3131
*
3232
* @var array
3333
*/
34-
private $data;
34+
private $data = [];
3535

3636
/**
3737
* Flattened data
3838
*
3939
* @var array
4040
*/
41-
private $flatData;
41+
private $flatData = [];
4242

4343
/**
4444
* Injected configuration data
@@ -72,6 +72,12 @@ public function __construct(DeploymentConfig\Reader $reader, array $overrideData
7272
*/
7373
public function get(string $key = null, $defaultValue = null)
7474
{
75+
if ($key === null) {
76+
if (empty($this->flatData)) {
77+
$this->reloadData();
78+
}
79+
return $this->flatData;
80+
}
7581
$result = $this->getByKey($key);
7682
if ($result === null) {
7783
$this->reloadData();
@@ -90,6 +96,12 @@ public function get(string $key = null, $defaultValue = null)
9096
*/
9197
public function getConfigData(string $key = null)
9298
{
99+
if ($key === null) {
100+
if (empty($this->data)) {
101+
$this->reloadData();
102+
}
103+
return $this->data;
104+
}
93105
$result = $this->getConfigDataByKey($key);
94106
if ($result === null) {
95107
$this->reloadData();
@@ -130,8 +142,8 @@ public function isDbAvailable(): bool
130142
*/
131143
public function resetData(): void
132144
{
133-
$this->data = null;
134-
$this->flatData = null;
145+
$this->data = [];
146+
$this->flatData = [];
135147
}
136148

137149
/**
@@ -197,7 +209,7 @@ private function getByKey(?string $key)
197209
if ($key === null) {
198210
return $this->flatData ?: null;
199211
}
200-
if (is_array($this->flatData) && array_key_exists($key, $this->flatData) && $this->flatData[$key] === null) {
212+
if (array_key_exists($key, $this->flatData) && $this->flatData[$key] === null) {
201213
return '';
202214
}
203215

@@ -210,9 +222,6 @@ private function getByKey(?string $key)
210222
*/
211223
private function getConfigDataByKey(?string $key)
212224
{
213-
if ($key === null) {
214-
return $this->data;
215-
}
216225
return $this->data[$key] ?? null;
217226
}
218227
}

0 commit comments

Comments
 (0)