From 6c50deee2c4c8967f390513da7e377a24a946d20 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 26 Jan 2021 11:53:44 -0700 Subject: [PATCH] Time condition exclude invalid presets with incorrect json syntax to make it more resilient. --- app/time_conditions/time_condition_edit.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index d9936e4ca7..e99afdb52d 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -49,8 +49,11 @@ $preset_region = "preset_".$_SESSION['time_conditions']['region']['text']; if (is_array($_SESSION['time_conditions'][$preset_region])) { foreach ($_SESSION['time_conditions'][$preset_region] as $json) { - $available_presets[] = json_decode($json, true); - $valid_presets[] = array_key_first(end($available_presets)); + $json_array = json_decode($json, true); + if (is_array($json_array)) { + $available_presets[] = $json_array; + $valid_presets[] = array_key_first(end($available_presets)); + } } } unset($preset_region); @@ -1296,4 +1299,4 @@ if ($action == 'update') { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?>