Fix PHP errors when trying to save with missing field data (#7620)

This commit is contained in:
frytimo
2025-11-16 00:29:51 -04:00
committed by GitHub
parent b151f3c4ce
commit c11920c932

View File

@@ -54,16 +54,16 @@
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (!empty($_POST)) { if (!empty($_POST)) {
$bridge_uuid = $_POST["bridge_uuid"]; $bridge_uuid = $_POST["bridge_uuid"] ?? null;
$bridge_name = $_POST["bridge_name"]; $bridge_name = $_POST["bridge_name"] ?? null;
$bridge_action = $_POST["bridge_action"]; $bridge_action = $_POST["bridge_action"] ?? null;
$bridge_profile = $_POST["bridge_profile"]; $bridge_profile = $_POST["bridge_profile"] ?? null;
$bridge_variables = $_POST["bridge_variables"]; $bridge_variables = $_POST["bridge_variables"] ?? null;
$bridge_gateways = $_POST["bridge_gateways"]; $bridge_gateways = $_POST["bridge_gateways"] ?? null;
$destination_number = $_POST["destination_number"]; $destination_number = $_POST["destination_number"] ?? null;
$bridge_destination = $_POST["bridge_destination"]; $bridge_destination = $_POST["bridge_destination"] ?? null;
$bridge_enabled = $_POST["bridge_enabled"]; $bridge_enabled = $_POST["bridge_enabled"] ?? null;
$bridge_description = $_POST["bridge_description"]; $bridge_description = $_POST["bridge_description"] ?? null;
} }
//process the user data and save it to the database //process the user data and save it to the database
@@ -314,7 +314,7 @@
} }
//get the gateways //get the gateways
$actions = explode(',', $bridge_destination); $actions = explode(',', $bridge_destination ?? '');
foreach ($actions as $action) { foreach ($actions as $action) {
$action_array = explode('/',$action); $action_array = explode('/',$action);
if (!empty($action_array) && is_array($action_array) && !empty($action_array[1]) && $action_array[1] == 'gateway') { if (!empty($action_array) && is_array($action_array) && !empty($action_array[1]) && $action_array[1] == 'gateway') {