Skip to content

Commit 584e001

Browse files
committed
Merge branch 'ACP2E-2198' of https://github.com/magento-l3/magento2ce into PR-L3-2023-07-14
2 parents da5d9f3 + 1e5836f commit 584e001

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,24 @@
3434
// memory leak, wrong sql, potential issues
3535
Magento\Framework\Event\Config\Data::class => null,
3636
Magento\Framework\App\AreaList::class => null,
37+
Magento\Framework\App\DeploymentConfig::class => null,
38+
Magento\Theme\Model\View\Design::class => null,
39+
Magento\Framework\App\Cache\Frontend\Pool::class => null,
40+
Magento\Framework\App\Cache\Type\FrontendPool::class => null,
41+
Magento\Framework\App\DeploymentConfig\Writer::class => null,
42+
Magento\Framework\App\Cache\State::class => null,
43+
Magento\Framework\Module\ModuleList::class => null,
44+
Magento\RemoteStorage\Model\Config::class => null,
45+
Magento\Store\Model\Config\Processor\Fallback::class => null,
46+
Magento\Framework\Lock\LockBackendFactory::class => null,
3747
'customRemoteFilesystem' => null,
48+
'systemConfigQueryLocker' => null,
49+
Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile::class => null,
50+
Magento\Config\App\Config\Source\RuntimeConfigSource::class => null,
51+
'scopesConfigInitialDataProvider' => null,
52+
Magento\Developer\Model\Logger\Handler\Debug::class => null,
53+
Magento\Developer\Model\Logger\Handler\Syslog::class => null,
54+
Magento\Store\App\Config\Source\RuntimeConfigSource::class => null,
3855
Magento\Store\App\Config\Type\Scopes::class => null,
3956
Magento\Framework\Module\Dir\Reader::class => null,
4057
Magento\Framework\Module\PackageInfo::class => null,

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ class DeploymentConfig
6161
*/
6262
private $readerLoad = [];
6363

64+
/**
65+
* @var array
66+
*/
67+
private $noConfigData = [];
68+
6469
/**
6570
* Constructor
6671
*
@@ -94,9 +99,17 @@ public function get($key = null, $defaultValue = null)
9499
}
95100
$result = $this->getByKey($key);
96101
if ($result === null) {
97-
if (empty($this->flatData) || count($this->getAllEnvOverrides())) {
102+
if (empty($this->flatData)
103+
|| !isset($this->flatData[$key]) && !isset($this->noConfigData[$key])
104+
|| count($this->getAllEnvOverrides())
105+
) {
106+
$this->resetData();
98107
$this->reloadData();
99108
}
109+
110+
if (!isset($this->flatData[$key])) {
111+
$this->noConfigData[$key] = $key;
112+
}
100113
$result = $this->getByKey($key);
101114
}
102115
return $result ?? $defaultValue;

lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,34 @@ public function testEnvVariablesSubstitution(): void
300300
$this->assertSame('D', $this->deploymentConfig->get('b'), 'return value from env');
301301
$this->assertSame('e$%^&', $this->deploymentConfig->get('c'), 'return default value');
302302
}
303+
304+
/**
305+
* @return void
306+
* @throws FileSystemException
307+
* @throws RuntimeException
308+
*/
309+
public function testReloadDataOnMissingConfig(): void
310+
{
311+
$this->readerMock->expects($this->exactly(2))
312+
->method('load')
313+
->willReturnOnConsecutiveCalls(
314+
['db' => ['connection' => ['default' => ['host' => 'localhost']]]],
315+
[],
316+
[]
317+
);
318+
$connectionConfig1 = $this->deploymentConfig->get(
319+
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . 'default'
320+
);
321+
$this->assertArrayHasKey('host', $connectionConfig1);
322+
$connectionConfig2 = $this->deploymentConfig->get(
323+
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . 'default'
324+
);
325+
$this->assertArrayHasKey('host', $connectionConfig2);
326+
$result1 = $this->deploymentConfig->get('missing/key');
327+
$this->assertNull($result1);
328+
$result2 = $this->deploymentConfig->get('missing/key');
329+
$this->assertNull($result2);
330+
$result3 = $this->deploymentConfig->get('missing/key');
331+
$this->assertNull($result3);
332+
}
303333
}

0 commit comments

Comments
 (0)