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

Conversation

christer77
Copy link
Member

PHP Warning: Undefined array key "X-Profile-ID" in ...\cypht\modules\smtp\functions.php on line 81

@christer77 christer77 requested a review from Shadow243 March 25, 2025 14:41
Copy link
Member

@Shadow243 Shadow243 left a comment

Choose a reason for hiding this comment

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

A small modification is necessary.

@@ -75,6 +75,9 @@ function send_scheduled_message($handler, $imapMailbox, $folder, $msg_id, $send_
}

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

@christer77 christer77 force-pushed the PHP-Warning-Undefined-array-key-X-Profile-ID branch from 8a7f1ed to aa41843 Compare April 19, 2025 08:57
@@ -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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants