From 4cf2cea27f1fd1ec6ab0ea1074b9f3e63e3b8706 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:46:23 -0700 Subject: [PATCH] Fix undefined array indexes (#7648) --- core/users/user_profile.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/users/user_profile.php b/core/users/user_profile.php index 0f578b94c1..8514a89717 100644 --- a/core/users/user_profile.php +++ b/core/users/user_profile.php @@ -64,7 +64,7 @@ $user_status = $_POST["user_status"] ?? ''; $user_language = $_POST["user_language"]; $user_time_zone = $_POST["user_time_zone"]; - $contact_attachment_uuid = $_POST['contact_attachment_uuid']; + $contact_attachment_uuid = $_POST['contact_attachment_uuid'] ?? ''; $contact_attachment = $_FILES['contact_attachment']; //get the totp secret @@ -149,6 +149,9 @@ //set the contact_uuid $contact_uuid = $_SESSION['user']['contact_uuid'] ?? uuid(); + //set initial array indexes + $i = $n = $x = $y = $c = 0; + //save contact $array['contacts'][$c]['contact_uuid'] = $contact_uuid; $array['contacts'][$c]['domain_uuid'] = $domain_uuid; @@ -201,6 +204,7 @@ $p->delete('contact_attachment_delete', 'temp'); } + //handle new profile photo else if (is_array($contact_attachment) && sizeof($contact_attachment) != 0 && $contact_attachment['error'] === 0) { $contact_attachment_extension = strtolower(pathinfo($contact_attachment['name'], PATHINFO_EXTENSION)); @@ -281,9 +285,6 @@ persistent_form_values('clear'); } - //save the data - $i = $n = $x = $c = 0; //set initial array indexes - //check to see if user language is set $sql = "select user_setting_uuid, user_setting_value from v_user_settings "; $sql .= "where user_setting_category = 'domain' ";