Fix php warning on not correcly loaded configs "Trying to access array offset on value of type null"

Reported for users not having correct permissions
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-04-20 00:12:54 +02:00
parent 652d264f9b
commit a497000b98
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -28,6 +28,7 @@ use const DIRECTORY_SEPARATOR;
use const E_USER_WARNING;
use function sprintf;
use function trigger_error;
use function is_array;
/**
* Handle front end templating
@ -63,7 +64,9 @@ class Template
'auto_reload' => true,
'cache' => $cache_dir,
]);
if ($cfg['environment'] === 'development') {
// It was reported that the config could not be loaded correctly
if (is_array($cfg) && $cfg['environment'] === 'development') {
$twig->enableDebug();
$twig->addExtension(new DebugExtension());
}