Mercurial > hg > rc2
changeset 25:bea5a38be938
More cleaning up php8 Warnings/deprecations
| author | Charlie Root |
|---|---|
| date | Sat, 18 Oct 2025 12:24:31 -0400 |
| parents | e53add5ddac5 |
| children | c4ade3f35fb2 c32b53434b47 |
| files | program/lib/Roundcube/rcube_addressbook.php program/lib/Roundcube/rcube_contacts.php program/lib/Roundcube/rcube_message.php program/lib/Roundcube/rcube_message_part.php program/lib/Roundcube/rcube_mime.php program/lib/Roundcube/rcube_result_set.php program/lib/Roundcube/rcube_result_thread.php program/lib/Roundcube/rcube_vcard.php program/steps/mail/get.inc |
| diffstat | 9 files changed, 73 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/program/lib/Roundcube/rcube_addressbook.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_addressbook.php Sat Oct 18 12:24:31 2025 -0400 @@ -197,7 +197,7 @@ */ function set_sort_order($sort_col, $sort_order = null) { - if ($sort_col != null && ($this->coltypes[$sort_col] || in_array($sort_col, $this->coltypes))) { + if ($sort_col != null && ((!empty($this->coltypes[$sort_col]) || in_array($sort_col, $this->coltypes))) { $this->sort_col = $sort_col; } if ($sort_order != null) {
--- a/program/lib/Roundcube/rcube_contacts.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_contacts.php Sat Oct 18 12:24:31 2025 -0400 @@ -203,6 +203,7 @@ */ function list_records($cols = null, $subset = 0, $nocount = false) { + $join = ""; if ($nocount || $this->list_page <= 1) { // create dummy result, we don't need a count now $this->result = new rcube_result_set(); @@ -481,6 +482,7 @@ */ private function _count() { + $join = ""; if ($this->group_id) $join = " LEFT JOIN " . $this->db->table_name($this->db_groupmembers, true) . " AS m". " ON (m.`contact_id` = c.`".$this->primary_key."`)";
--- a/program/lib/Roundcube/rcube_message.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_message.php Sat Oct 18 12:24:31 2025 -0400 @@ -46,9 +46,12 @@ * * @var rcube_mime */ - private $mime; - private $opt = array(); - private $parse_alternative = false; + protected $mime; + + protected $opt = []; + protected $parse_alternative = false; + protected $got_html_part = false; + protected $tnef_decode = false; public $uid; public $folder; @@ -308,7 +311,7 @@ } // detect charset... - if (!$part->charset || strtoupper($part->charset) == 'US-ASCII') { + if (empty($part->charset) || strtoupper($part->charset) == 'US-ASCII') { // try to extract charset information from HTML meta tag (#1488125) if ($part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-_]+)/i', $body, $m)) { $part->charset = strtoupper($m[1]); @@ -347,7 +350,7 @@ continue; } - if (!$part->size) { + if (empty($part->size)) { continue; } @@ -659,13 +662,13 @@ // check if sub part is if ($is_multipart) $related_part = $p; - else if ($sub_mimetype == 'text/plain' && !$plain_part) + else if ($sub_mimetype == 'text/plain' && empty($plain_part)) $plain_part = $p; - else if ($sub_mimetype == 'text/html' && !$html_part) { + else if ($sub_mimetype == 'text/html' && empty($html_part)) { $html_part = $p; $this->got_html_part = true; } - else if ($sub_mimetype == 'text/enriched' && !$enriched_part) + else if ($sub_mimetype == 'text/enriched' && empty($enriched_part)) $enriched_part = $p; else { // add unsupported/unrecognized parts to attachments list @@ -845,7 +848,7 @@ ) { if ($mail_part->headers['content-id']) $mail_part->content_id = preg_replace(array('/^</', '/>$/'), '', $mail_part->headers['content-id']); - if (!isempty($mail_part->headers['content-location'])) + if (!empty($mail_part->headers['content-location'])) $mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location']; $this->add_part($mail_part, 'inline');
--- a/program/lib/Roundcube/rcube_message_part.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_message_part.php Sat Oct 18 12:24:31 2025 -0400 @@ -57,6 +57,20 @@ public $mimetype = 'text/plain'; /** + * Real content type (for fake parts) + * + * @var string|null + */ + public $realtype; + + /** + * Real content type of a message/rfc822 part + * + * @var string + */ + public $real_mimetype = ''; + + /** * Part size in bytes * * @var int @@ -64,12 +78,40 @@ public $size = 0; /** + * Part body + * + * @var string|null + */ + public $body; + + /** * Part headers * * @var array */ - public $headers = array(); - public $body; + public $headers = []; + + /** + * Sub-Parts + * + * @var array + */ + public $parts = []; + + /** + * Part Content-Id + * + * @var string|null + */ + public $content_id; + + /** + * Part Content-Location + * + * @var string|null + */ + public $content_location; + public $type; public $disposition = ''; public $filename = ''; @@ -78,6 +120,7 @@ public $d_parameters = array(); public $ctype_parameters = array(); public $replaces = []; + public $body_modified = false; /** * Clone handler.
--- a/program/lib/Roundcube/rcube_mime.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_mime.php Sat Oct 18 12:24:31 2025 -0400 @@ -837,7 +837,7 @@ ); foreach ($aliases as $mime => $exts) { - $mime_types[$mime] = array_unique(array_merge((array) $mime_types[$mime], $exts)); + $mime_types[$mime] = array_unique(array_merge((array) ($mime_types[$mime]??null), $exts)); foreach ($exts as $ext) { if (!isset($mime_extensions[$ext])) {
--- a/program/lib/Roundcube/rcube_result_set.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_result_set.php Sat Oct 18 12:24:31 2025 -0400 @@ -47,7 +47,11 @@ function iterate() { - return $this->records[$this->current++]; + $current = $this->current(); + + $this->current++; + + return $current; } function first() @@ -84,7 +88,7 @@ unset($this->records[$offset]); } - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->records[$offset]; } @@ -98,7 +102,7 @@ function current(): mixed { - return $this->records[$this->current]; + return ($this->records[$this->current]??null); } function key(): mixed
--- a/program/lib/Roundcube/rcube_result_thread.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_result_thread.php Sat Oct 18 12:24:31 2025 -0400 @@ -74,7 +74,7 @@ return; } - $data = array_first($data); + $data = array_shift($data); $data = trim($data); $data = preg_replace('/[\r\n]/', '', $data); $data = preg_replace('/\s+/', ' ', $data);
--- a/program/lib/Roundcube/rcube_vcard.php Fri Oct 17 17:31:22 2025 -0400 +++ b/program/lib/Roundcube/rcube_vcard.php Sat Oct 18 12:24:31 2025 -0400 @@ -647,7 +647,7 @@ foreach ($regs2[1] as $attrid => $attr) { $attr = preg_replace('/[\s\t\n\r\0\x0B]/', '', $attr); - if ((list($key, $value) = explode('=', $attr)) && $value) { + if ((@list($key, $value) = explode('=', $attr)) && $value) { if ($key == 'ENCODING') { $value = strtoupper($value); // add next line(s) to value string if QP line end detected @@ -660,7 +660,7 @@ } else { $lc_key = strtolower($key); - $entry[$lc_key] = array_merge((array)$entry[$lc_key], (array)self::vcard_unquote($value, ',')); + $entry[$lc_key] = array_merge((array)($entry[$lc_key]??null), (array)self::vcard_unquote($value, ',')); } } else if ($attrid > 0) {
--- a/program/steps/mail/get.inc Fri Oct 17 17:31:22 2025 -0400 +++ b/program/steps/mail/get.inc Sat Oct 18 12:24:31 2025 -0400 @@ -396,7 +396,7 @@ // similar code as in program/steps/mail/show.inc if (!empty($uid)) { $rcube->config->set('prefer_html', true); - $this->message = new rcube_message($uid, null, intval($_GET['_safe'])); + $this->message = new rcube_message($uid, null, intval(($_GET['_safe']??null))); if ($this->part = $this->message->mime_parts[$part_id]) { $this->filename = rcmail_attachment_name($this->part); @@ -422,7 +422,7 @@ // overwrite modified vars from plugin $this->mimetype = $plugin['mimetype']; - if ($plugin['body']) { + if (($plugin['body']??false)) { $this->body = $plugin['body']; $this->size = strlen($this->body); }
