Time condition exclude invalid presets with incorrect json syntax to make it more resilient.

This commit is contained in:
FusionPBX 2021-01-26 11:53:44 -07:00 committed by GitHub
parent 3f7697b59d
commit 6c50deee2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -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";
?>
?>