From 1cca53e76d8158a5d7565a38307e0e3eb1926f4e Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 15 Nov 2019 20:19:22 +0300 Subject: [PATCH] fix(core): fix default and site settings loading #297 --- flextype/bootstrap.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index dc6b4771..b52859b8 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -54,19 +54,27 @@ $site_settings_file_path = PATH['config']['site'] . '/settings.yaml'; // Set settings if Flextype settings and Site settings config files exist if (! Filesystem::has($default_settings_file_path) || ! Filesystem::has($site_settings_file_path)) { - throw new RuntimeException('Flextype settings and Site settings config files does not exist.'); + throw new RuntimeException('Flextype settings or Site settings config files does not exist.'); } if (($content = Filesystem::read($default_settings_file_path)) === false) { throw new RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!'); } else { - $default_settings = Yaml::decode($content); + if (trim($content) === '') { + $default_settings = []; + } else { + $default_settings = Yaml::decode($content); + } } if (($content = Filesystem::read($site_settings_file_path)) === false) { throw new RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!'); } else { - $site_settings = Yaml::decode($content); + if (trim($content) === '') { + $site_settings = []; + } else { + $site_settings = Yaml::decode($content); + } } // Merge settings