From a497000b98eccfa38b67607730143b012379c904 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 20 Apr 2021 00:12:54 +0200 Subject: [PATCH] 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 --- libraries/classes/Template.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/classes/Template.php b/libraries/classes/Template.php index 010c9385d8..208ebef1a0 100644 --- a/libraries/classes/Template.php +++ b/libraries/classes/Template.php @@ -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()); }