From 8ce0f0537189205548b93ce1e2672b3a8848933f Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 22 Jul 2020 09:41:09 +0000 Subject: [PATCH] [UTIL] Update Common::config to ensure the values queried exist --- src/Util/Common.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Util/Common.php b/src/Util/Common.php index 67b8b51457..858c48893f 100644 --- a/src/Util/Common.php +++ b/src/Util/Common.php @@ -40,7 +40,12 @@ abstract class Common */ public static function config(string $section, string $setting) { - return unserialize(DB::find('config', ['section' => $section, 'setting' => $setting])->getValue()); + $c = DB::find('config', ['section' => $section, 'setting' => $setting]); + if ($c === null) { + throw new Exception("The field section = {$section} and setting = {$setting} doesn't exist"); + } + + return unserialize($c->getValue()); } /**