From c4f3565a157c12d49fcaad1adda38ed346eb4075 Mon Sep 17 00:00:00 2001 From: fusionate Date: Mon, 17 Jul 2023 22:52:03 +0000 Subject: [PATCH] Provisioning: Updates to resolve PHP 8.1 warnings. --- app/provision/index.php | 4 ++-- app/provision/resources/classes/provision.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index 184e8ac569..d106521c4f 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -296,7 +296,7 @@ } //check the cidr range - if (is_array($_SESSION['provision']["cidr"])) { + if (!empty($_SESSION['provision']["cidr"]) && is_array($_SESSION['provision']["cidr"])) { $found = false; foreach($_SESSION['provision']["cidr"] as $cidr) { if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) { @@ -312,7 +312,7 @@ //http authentication - digest if (!empty($provision["http_auth_username"]) && empty($provision["http_auth_type"])) { $provision["http_auth_type"] = "digest"; } - if (!empty($provision["http_auth_username"]) && $provision["http_auth_type"] === "digest" && $provision["http_auth_enabled"] === "true") { + if (!empty($provision["http_auth_username"]) && $provision["http_auth_type"] === "digest" && !empty($provision["http_auth_enabled"]) && $provision["http_auth_enabled"] === "true") { //function to parse the http auth header function http_digest_parse($txt) { //protect against missing data diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 15dd6ec12a..713d1bf7da 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -212,8 +212,8 @@ $x = 0; foreach ($database_contacts as &$row) { $uuid = $row['contact_uuid']; - $phone_label = strtolower($row['phone_label']); - $contact_category = strtolower($row['contact_category']); + $phone_label = strtolower($row['phone_label'] ?? ''); + $contact_category = strtolower($row['contact_category'] ?? ''); $contact = array(); $contacts[] = &$contact; @@ -234,7 +234,7 @@ $contact['phone_extension'] = $row['phone_extension']; } - $numbers[$x]['line_number'] = $line['line_number']; + $numbers[$x]['line_number'] = $line['line_number'] ?? null; $numbers[$x]['phone_label'] = $phone_label; $numbers[$x]['phone_number'] = $row['phone_number']; $numbers[$x]['phone_extension'] = $row['phone_extension']; @@ -905,7 +905,7 @@ } //get the extensions and add them to the contacts array - if (is_uuid($device_uuid) && is_uuid($domain_uuid) && $_SESSION['provision']['contact_extensions']['boolean'] == "true") { + if (is_uuid($device_uuid) && is_uuid($domain_uuid) && !empty($_SESSION['provision']['contact_extensions']['boolean']) && $_SESSION['provision']['contact_extensions']['boolean'] == "true") { //get contacts from the database $sql = "select extension_uuid as contact_uuid, directory_first_name, directory_last_name, "; $sql .= "effective_caller_id_name, effective_caller_id_number, ";