Skip to content

fix(other): php warning: undefined array key 'x-profile-id' #1484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion modules/smtp/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,18 @@ function send_scheduled_message($handler, $imapMailbox, $folder, $msg_id, $send_
$msg_headers = $imapMailbox->get_message_headers($folder, $msg_id);
$mailbox_details = $imapMailbox->get_config();
try {
if (empty($msg_headers['X-Schedule'])) {
if (! isset($msg_headers['X-Schedule'])) {
Copy link
Member

@Shadow243 Shadow243 Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christer77 empty has isset and other condition. keep empty not isset

https://www.php.net/manual/fr/function.empty.php

return false;
} else {
if (empty($msg_headers['X-Schedule'])) {
return false;
}
}

if (new DateTime($msg_headers['X-Schedule']) <= new DateTime() || $send_now) {
if (! isset($msg_headers['X-Profile-ID'])) {
Copy link
Member

@Shadow243 Shadow243 Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the condition at the same position as X-Schedule at line 73 and use empty instead of isset

return false;
}
$profile = Hm_Profiles::get($msg_headers['X-Profile-ID']);
if (!$profile) {
$profiles = Hm_Profiles::search('server', $mailbox_details['server']);
Expand Down