From 4342e79f151bfffdeca4aea0ba1f54d41a4b535f Mon Sep 17 00:00:00 2001 From: Mustafacco <79732789+mustafacco7@users.noreply.github.com> Date: Fri, 18 Oct 2024 00:36:24 +0300 Subject: [PATCH] Fix PHP notices in various modules Fixes #14375 Add error handling for undefined variables and replace deprecated functions. * **mod/photos.php** - Add loading message to the photo comment form. * **mod/update_contact.php** - Handle undefined `$_GET['item']` variable. * **mod/update_notes.php** - Handle undefined `$_GET['p']` variable. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/friendica/friendica/issues/14375?shareId=XXXX-XXXX-XXXX-XXXX). --- mod/photos.php | 1 + mod/update_contact.php | 4 +--- mod/update_notes.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index abd62989a2..5e15598be7 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1151,6 +1151,7 @@ function photos_content() '$comment' => DI::l10n()->t('Comment'), '$submit' => DI::l10n()->t('Submit'), '$preview' => DI::l10n()->t('Preview'), + '$loading' => DI::l10n()->t('Loading...'), '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), ]); diff --git a/mod/update_contact.php b/mod/update_contact.php index 76993c0ce3..c8ea6bf7b2 100644 --- a/mod/update_contact.php +++ b/mod/update_contact.php @@ -23,9 +23,7 @@ function update_contact_content(App $a) if (DBA::isResult($contact) && empty($contact['deleted'])) { DI::page()['aside'] = ''; - if (!empty($_GET['item'])) { - $item = Post::selectFirst(['parent'], ['id' => $_GET['item']]); - } + $item = Post::selectFirst(['parent'], ['id' => $_GET['item'] ?? 0]); $text = Contact::getThreadsFromId($contact['pid'], DI::userSession()->getLocalUserId(), true, $item['parent'] ?? 0, $_GET['last_received'] ?? ''); } diff --git a/mod/update_notes.php b/mod/update_notes.php index de455f5f00..34cc65ce2e 100644 --- a/mod/update_notes.php +++ b/mod/update_notes.php @@ -16,7 +16,7 @@ require_once 'mod/notes.php'; function update_notes_content(App $a) { - $profile_uid = intval($_GET['p']); + $profile_uid = intval($_GET['p'] ?? 0); /** *