Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2022-01-11 21:04:24 +0300
committerAleksander Machniak <alec@alec.pl>2022-01-11 21:04:24 +0300
commitf429b2681032c1c1c21694175f62fb57d8f41617 (patch)
treec9b2eccd3e06b551eaff05c313327cd09aa05e05
parenta5fd2117128a1e81912fcfb6671ce4a16cd7f6d4 (diff)
Fix various PHP8 warnings (#8392)
-rw-r--r--CHANGELOG.md1
-rw-r--r--index.php2
-rw-r--r--program/actions/contacts/index.php2
-rw-r--r--program/actions/mail/compose.php2
-rw-r--r--program/actions/mail/index.php4
-rw-r--r--program/actions/mail/move.php2
-rw-r--r--program/actions/settings/about.php29
-rw-r--r--program/actions/settings/folder_save.php5
-rw-r--r--program/lib/Roundcube/rcube.php4
-rw-r--r--program/lib/Roundcube/rcube_addressbook.php2
-rw-r--r--program/lib/Roundcube/rcube_imap.php5
-rw-r--r--program/lib/Roundcube/rcube_message.php11
-rw-r--r--program/lib/Roundcube/rcube_mime.php2
-rw-r--r--program/lib/Roundcube/rcube_plugin_api.php4
-rw-r--r--program/lib/Roundcube/rcube_vcard.php16
15 files changed, 70 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8145d677a..b4efb00dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -57,6 +57,7 @@
- Fix locked SQLite database for the CLI tools (#8035)
- Fix Makefile on Linux (#8211)
- Fix so PHP warnings are ignored when resizing a malformed image attachment (#8387)
+- Fix various PHP8 warnings (#8392)
## Release 1.5.2
diff --git a/index.php b/index.php
index 16128bc23..63e1d0855 100644
--- a/index.php
+++ b/index.php
@@ -97,7 +97,7 @@ $session_error = null;
// try to log in
if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') {
- $request_valid = $_SESSION['temp'] && $RCMAIL->check_request();
+ $request_valid = !empty($_SESSION['temp']) && $RCMAIL->check_request();
$pass_charset = $RCMAIL->config->get('password_charset', 'UTF-8');
// purge the session in case of new login when a session already exists
diff --git a/program/actions/contacts/index.php b/program/actions/contacts/index.php
index b2ecc7406..112a6f3d3 100644
--- a/program/actions/contacts/index.php
+++ b/program/actions/contacts/index.php
@@ -1335,7 +1335,7 @@ class rcmail_action_contacts_index extends rcmail_action
if (self::$contact['photo'] == '-del-') {
$record['photo'] = '';
}
- else if ($_SESSION['contacts']['files'][self::$contact['photo']]) {
+ else if (!empty($_SESSION['contacts']['files'][self::$contact['photo']])) {
$record['photo'] = $file_id = self::$contact['photo'];
}
}
diff --git a/program/actions/mail/compose.php b/program/actions/mail/compose.php
index 4b82a9df8..5f28f25f5 100644
--- a/program/actions/mail/compose.php
+++ b/program/actions/mail/compose.php
@@ -39,7 +39,7 @@ class rcmail_action_mail_compose extends rcmail_action_mail_index
self::$COMPOSE_ID = rcube_utils::get_input_string('_id', rcube_utils::INPUT_GET);
self::$COMPOSE = null;
- if (self::$COMPOSE_ID && $_SESSION['compose_data_' . self::$COMPOSE_ID]) {
+ if (self::$COMPOSE_ID && !empty($_SESSION['compose_data_' . self::$COMPOSE_ID])) {
self::$COMPOSE =& $_SESSION['compose_data_' . self::$COMPOSE_ID];
}
diff --git a/program/actions/mail/index.php b/program/actions/mail/index.php
index 428329449..c297bbba4 100644
--- a/program/actions/mail/index.php
+++ b/program/actions/mail/index.php
@@ -211,7 +211,7 @@ class rcmail_action_mail_index extends rcmail_action
if (isset($_GET['_threads'])) {
if ($_GET['_threads']) {
// re-set current page number when listing mode changes
- if (!$a_threading[$_SESSION['mbox']]) {
+ if (empty($a_threading[$_SESSION['mbox']])) {
$rcmail->storage->set_page($_SESSION['page'] = 1);
}
@@ -219,7 +219,7 @@ class rcmail_action_mail_index extends rcmail_action
}
else {
// re-set current page number when listing mode changes
- if ($a_threading[$_SESSION['mbox']]) {
+ if (!empty($a_threading[$_SESSION['mbox']])) {
$rcmail->storage->set_page($_SESSION['page'] = 1);
}
diff --git a/program/actions/mail/move.php b/program/actions/mail/move.php
index 36630dcc2..323d084c1 100644
--- a/program/actions/mail/move.php
+++ b/program/actions/mail/move.php
@@ -66,7 +66,7 @@ class rcmail_action_mail_move extends rcmail_action_mail_index
if (!$success) {
// send error message
- if ($_POST['_from'] != 'show') {
+ if (empty($_POST['_from']) || $_POST['_from'] != 'show') {
$rcmail->output->command('list_mailbox');
}
diff --git a/program/actions/settings/about.php b/program/actions/settings/about.php
index e9ec91309..bb3a62335 100644
--- a/program/actions/settings/about.php
+++ b/program/actions/settings/about.php
@@ -112,13 +112,34 @@ class rcmail_action_settings_about extends rcmail_action
$uri = 'http://' . $uri;
}
+ if ($uri) {
+ $uri = html::a([
+ 'target' => '_blank',
+ 'href' => rcube::Q($uri)
+ ],
+ rcube::Q($rcmail->gettext('download'))
+ );
+ }
+
+ $license = isset($data['license']) ? $data['license'] : '';
+
+ if (!empty($data['license_uri'])) {
+ $license = html::a([
+ 'target' => '_blank',
+ 'href' => rcube::Q($data['license_uri'])
+ ],
+ rcube::Q($data['license'])
+ );
+ }
+ else {
+ $license = rcube::Q($license);
+ }
+
$table->add_row();
$table->add('name', rcube::Q(!empty($data['name']) ? $data['name'] : $name));
$table->add('version', !empty($data['version']) ? rcube::Q($data['version']) : '');
- $table->add('license', !empty($data['license_uri']) ? html::a(['target' => '_blank', 'href' => rcube::Q($data['license_uri'])],
- rcube::Q($data['license'])) : $data['license']);
- $table->add('source', $uri ? html::a(['target' => '_blank', 'href' => rcube::Q($uri)],
- rcube::Q($rcmail->gettext('download'))) : '');
+ $table->add('license', $license);
+ $table->add('source', $uri);
}
return $table->show();
diff --git a/program/actions/settings/folder_save.php b/program/actions/settings/folder_save.php
index 9ba1a213f..e264cf39a 100644
--- a/program/actions/settings/folder_save.php
+++ b/program/actions/settings/folder_save.php
@@ -104,14 +104,15 @@ class rcmail_action_settings_folder_save extends rcmail_action_settings_folder_e
'view_mode' => (int) rcube_utils::get_input_string('_viewmode', rcube_utils::INPUT_POST),
'sort_column' => rcube_utils::get_input_string('_sortcol', rcube_utils::INPUT_POST),
'sort_order' => rcube_utils::get_input_string('_sortord', rcube_utils::INPUT_POST),
- ]
+ ],
+ 'subscribe' => false,
+ 'noselect' => false,
];
}
// create a new mailbox
if (empty($error) && !strlen($old_imap)) {
$folder['subscribe'] = true;
- $folder['noselect'] = false;
// Server does not support both sub-folders and messages in a folder
// For folders that are supposed to contain other folders we will:
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 693cf7614..c51942dc8 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -1437,6 +1437,10 @@ class rcube
return;
}
+ if (!isset($arg['message'])) {
+ $arg['message'] = '';
+ }
+
if (($log || $terminate) && !$cli && $arg['message']) {
$arg['fatal'] = $terminate;
self::log_bug($arg);
diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php
index 14a3bfaf7..3b3b6ad20 100644
--- a/program/lib/Roundcube/rcube_addressbook.php
+++ b/program/lib/Roundcube/rcube_addressbook.php
@@ -827,7 +827,7 @@ abstract class rcube_addressbook
*/
public static function compose_contact_key($contact, $sort_col)
{
- $key = $contact[$sort_col];
+ $key = isset($contact[$sort_col]) ? $contact[$sort_col] : null;
// add email to a key to not skip contacts with the same name (#1488375)
if (($email = self::get_col_values('email', $contact, true)) && !empty($email)) {
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 083d2b13e..c82bdfa88 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -3659,7 +3659,10 @@ class rcube_imap extends rcube_storage
}
$this->conn->listMailboxes('', $folder);
- $opts = $this->conn->data['LIST'][$folder];
+
+ if (isset($this->conn->data['LIST'][$folder])) {
+ $opts = $this->conn->data['LIST'][$folder];
+ }
}
return isset($opts) && is_array($opts) ? $opts : [];
diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index b46bf6aa9..206ae807d 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -605,7 +605,8 @@ class rcube_message
// parse headers from message/rfc822 part
if (!isset($structure->headers['subject']) && !isset($structure->headers['from'])) {
- list($headers, $body) = explode("\r\n\r\n", $this->get_part_body($structure->mime_id, false, 32768), 2);
+ $part_body = $this->get_part_body($structure->mime_id, false, 32768);
+ list($headers, $body) = rcube_utils::explode("\r\n\r\n", $part_body, 2);
$structure->headers = rcube_mime::parse_headers($headers);
if ($this->context === $structure->mime_id) {
@@ -909,7 +910,7 @@ class rcube_message
// part is a file/attachment
else if (
preg_match('/^(inline|attach)/', $mail_part->disposition)
- || $mail_part->headers['content-id']
+ || !empty($mail_part->headers['content-id'])
|| ($mail_part->filename &&
(empty($mail_part->disposition) || preg_match('/^[a-z0-9!#$&.+^_-]+$/i', $mail_part->disposition)))
) {
@@ -923,7 +924,11 @@ class rcube_message
}
if (!empty($mail_part->headers['content-location'])) {
- $mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location'];
+ $mail_part->content_location = '';
+ if (!empty($mail_part->headers['content-base'])) {
+ $mail_part->content_location = $mail_part->headers['content-base'];
+ }
+ $mail_part->content_location .= $mail_part->headers['content-location'];
}
// part belongs to a related message and is linked
diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php
index ca5bfa66d..f73672f6b 100644
--- a/program/lib/Roundcube/rcube_mime.php
+++ b/program/lib/Roundcube/rcube_mime.php
@@ -820,7 +820,7 @@ class rcube_mime
// return cached data
if (is_array($mime_types)) {
- return $mimetype ? $mime_types[$mimetype] : $mime_extensions;
+ return $mimetype ? (isset($mime_types[$mimetype]) ? $mime_types[$mimetype] : []) : $mime_extensions;
}
// load mapping file
diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php
index b15c53a9c..74653ef66 100644
--- a/program/lib/Roundcube/rcube_plugin_api.php
+++ b/program/lib/Roundcube/rcube_plugin_api.php
@@ -386,8 +386,8 @@ class rcube_plugin_api
) {
$lock = $composer_lock['installed'][$json['name']];
$info['version'] = $lock['version'];
- $info['uri'] = $lock['homepage'] ?: $lock['source']['uri'];
- $info['src_uri'] = $lock['dist']['uri'] ?: $lock['source']['uri'];
+ $info['uri'] = !empty($lock['homepage']) ? $lock['homepage'] : $lock['source']['url'];
+ $info['src_uri'] = !empty($lock['dist']['url']) ? $lock['dist']['url'] : $lock['source']['url'];
}
}
diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php
index debb432c8..222c7e5ab 100644
--- a/program/lib/Roundcube/rcube_vcard.php
+++ b/program/lib/Roundcube/rcube_vcard.php
@@ -254,7 +254,21 @@ class rcube_vcard
// split ADR values into assoc array
if ($tag == 'ADR') {
- list(,, $value['street'], $value['locality'], $value['region'], $value['zipcode'], $value['country']) = $raw;
+ if (isset($raw[2])) {
+ $value['street'] = $raw[2];
+ }
+ if (isset($raw[3])) {
+ $value['locality'] = $raw[3];
+ }
+ if (isset($raw[4])) {
+ $value['region'] = $raw[4];
+ }
+ if (isset($raw[5])) {
+ $value['zipcode'] = $raw[5];
+ }
+ if (isset($raw[6])) {
+ $value['country'] = $raw[6];
+ }
$out[$key][] = $value;
}
// support vCard v4 date format (YYYYMMDD)