changeset 27:c32b53434b47

more compensation for deprecated empty cases
author Charlie Root
date Sun, 18 Jan 2026 14:20:29 -0500
parents bea5a38be938
children 6e8e57ef139f
files program/include/rcmail.php program/lib/Roundcube/html.php program/lib/Roundcube/rcube_addressbook.php program/lib/Roundcube/rcube_imap.php program/lib/Roundcube/rcube_message.php program/lib/Roundcube/rcube_message_header.php program/lib/Roundcube/rcube_mime.php program/lib/Roundcube/rcube_storage.php program/lib/Roundcube/rcube_string_replacer.php program/lib/Roundcube/rcube_text2html.php program/lib/Roundcube/rcube_vcard.php program/lib/Roundcube/rcube_washtml.php program/steps/addressbook/search.inc program/steps/mail/autocomplete.inc program/steps/mail/get.inc program/steps/mail/move_del.inc
diffstat 16 files changed, 44 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/program/include/rcmail.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/include/rcmail.php	Sun Jan 18 14:20:29 2026 -0500
@@ -200,6 +200,7 @@
     public function get_address_book($id, $writeable = false)
     {
         $contacts    = null;
+	$default = false;
         $ldap_config = (array)$this->config->get('ldap_public');
 
         // 'sql' is the alias for '0' used by autocomplete
@@ -1496,7 +1497,7 @@
             $currentFolder = substr($folder, 0, $pos);
 
             // sometimes folder has a delimiter as the last character
-            if (!strlen($subFolders)) {
+            if (empty($subFolders)) {
                 $virtual = false;
             }
             else if (!isset($arrFolders[$currentFolder])) {
@@ -2428,8 +2429,8 @@
 
             // create a per-folder UIDs array
             foreach ((array)$_uid as $uid) {
-                list($uid, $mbox) = explode('-', $uid, 2);
-                if (!strlen($mbox)) {
+	      list($uid, $mbox) = array_pad(explode('-', $uid, 2), 2, "");
+                if (empty($mbox)) {
                     $mbox = $_mbox;
                 }
                 else {
--- a/program/lib/Roundcube/html.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/html.php	Sun Jan 18 14:20:29 2026 -0500
@@ -953,6 +953,6 @@
     private function _col_tagname()
     {
         static $col_tagnames = array('table' => 'td', '*' => 'span');
-        return $col_tagnames[$this->tagname] ?: $col_tagnames['*'];
+        return ($col_tagnames[$this->tagname]??false) ?: $col_tagnames['*'];
     }
 }
--- a/program/lib/Roundcube/rcube_addressbook.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_addressbook.php	Sun Jan 18 14:20:29 2026 -0500
@@ -197,7 +197,7 @@
      */
     function set_sort_order($sort_col, $sort_order = null)
     {
-      if ($sort_col != null && ((!empty($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_imap.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_imap.php	Sun Jan 18 14:20:29 2026 -0500
@@ -625,7 +625,7 @@
      */
     public function count($folder='', $mode='ALL', $force=false, $status=true)
     {
-        if (!strlen($folder)) {
+        if (empty($folder)) {
             $folder = $this->folder;
         }
 
@@ -1568,6 +1568,7 @@
             'charset'    => $charset,
             'sort_field' => $sort_field,
             'threading'  => $this->threading,
+	    'result'     => null,
         ));
 
         $folder     = $plugin['folder'];
@@ -4385,7 +4386,7 @@
     {
         $a_folder_cache = $this->get_cache('messagecount');
 
-        if (is_array($a_folder_cache[$folder])) {
+        if (isset($a_folder_cache[$folder]) && is_array($a_folder_cache[$folder])) {
             if (!empty($mode)) {
                 foreach ((array) $mode as $key) {
                     unset($a_folder_cache[$folder][$key]);
--- a/program/lib/Roundcube/rcube_message.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_message.php	Sun Jan 18 14:20:29 2026 -0500
@@ -677,7 +677,7 @@
             }
 
             // parse related part (alternative part could be in here)
-            if ($related_part !== null && !$this->parse_alternative) {
+            if (isset($related_part) && !$this->parse_alternative) {
                 $this->parse_alternative = true;
                 $this->parse_structure($structure->parts[$related_part], true);
                 $this->parse_alternative = false;
--- a/program/lib/Roundcube/rcube_message_header.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_message_header.php	Sun Jan 18 14:20:29 2026 -0500
@@ -72,6 +72,13 @@
     public $cc;
 
     /**
+     * Message hidden recipients (Bcc)
+     *
+     * @var string
+     */
+    public $bcc;
+
+    /**
      * Message Reply-To header
      *
      * @var string
@@ -310,6 +317,7 @@
 {
   class rcube_message_header extends r_m_h_base {
     public $list_flags = array();
+    public $sortKey = null;
   }
 } else {
   class rcube_message_header extends r_m_h_base { }
--- a/program/lib/Roundcube/rcube_mime.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_mime.php	Sun Jan 18 14:20:29 2026 -0500
@@ -485,7 +485,7 @@
                 }
                 else {
                     // remove space-stuffing
-                    if ($line[0] === ' ') $line = substr($line, 1);
+		  if ($line[0]?:'' === ' ') $line = substr($line, 1);
 
                     if (isset($text[$last]) && $line && !$q_level
                         && $text[$last] != '-- '
--- a/program/lib/Roundcube/rcube_storage.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_storage.php	Sun Jan 18 14:20:29 2026 -0500
@@ -580,6 +580,8 @@
      */
     protected function parse_uids($uids)
     {
+      $all = false;
+
         if ($uids === '*' || $uids === '1:*') {
             if (empty($this->search_set)) {
                 $uids = '1:*';
--- a/program/lib/Roundcube/rcube_string_replacer.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_string_replacer.php	Sun Jan 18 14:20:29 2026 -0500
@@ -91,6 +91,8 @@
     {
         $i = -1;
         $scheme = strtolower($matches[1]);
+	$url_prefix = '';
+	$prefix = '';
 
         if (preg_match('!^(http|ftp|file)s?://!i', $scheme)) {
             $url = $matches[1] . $matches[2];
@@ -209,6 +211,8 @@
         // Yes, this is not perfect handles correctly only paired characters
         // but it should work for common cases
 
+      $suffix = '';
+
         if (preg_match('/(\\[|\\])/', $url)) {
             $in = false;
             for ($i=0, $len=strlen($url); $i<$len; $i++) {
--- a/program/lib/Roundcube/rcube_text2html.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_text2html.php	Sun Jan 18 14:20:29 2026 -0500
@@ -176,7 +176,7 @@
         // wrap quoted lines with <blockquote>
         for ($n = 0, $cnt = count($text); $n < $cnt; $n++) {
             $flowed = false;
-            if ($this->config['flowed'] && ord($text[$n][0]) == $flowed_char) {
+            if ($this->config['flowed'] && ord($text[$n][0]??null) == $flowed_char) {
                 $flowed   = true;
                 $text[$n] = substr($text[$n], 1);
             }
--- a/program/lib/Roundcube/rcube_vcard.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_vcard.php	Sun Jan 18 14:20:29 2026 -0500
@@ -544,7 +544,7 @@
         // convert Apple X-ABRELATEDNAMES into X-* fields for better compatibility
         $vcard = preg_replace_callback(
             '/item(\d+)\.(X-ABRELATEDNAMES)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w\-() ]*)(?:>!\$_)?./s',
-            array('self', 'x_abrelatednames_callback'),
+            array('rcube_vcard', 'x_abrelatednames_callback'),
             $vcard);
 
         // Cleanup
--- a/program/lib/Roundcube/rcube_washtml.php	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/lib/Roundcube/rcube_washtml.php	Sun Jan 18 14:20:29 2026 -0500
@@ -214,10 +214,10 @@
      */
     public function __construct($p = array())
     {
-        $this->_html_elements   = array_flip((array)$p['html_elements']) + array_flip(self::$html_elements);
-        $this->_html_attribs    = array_flip((array)$p['html_attribs']??array()) + array_flip(self::$html_attribs);
-        $this->_ignore_elements = array_flip((array)$p['ignore_elements']??array()) + array_flip(self::$ignore_elements);
-        $this->_void_elements   = array_flip((array)$p['void_elements']??array()) + array_flip(self::$void_elements);
+      $this->_html_elements   = array_flip((array)($p['html_elements']??array())) + array_flip(self::$html_elements);
+      $this->_html_attribs    = array_flip((array)($p['html_attribs']??array())) + array_flip(self::$html_attribs);
+      $this->_ignore_elements = array_flip((array)($p['ignore_elements']??array())) + array_flip(self::$ignore_elements);
+      $this->_void_elements   = array_flip((array)($p['void_elements']??array())) + array_flip(self::$void_elements);
 
         unset($p['html_elements'], $p['html_attribs'], $p['ignore_elements'], $p['void_elements']);
 
@@ -367,8 +367,8 @@
     private function wash_uri($uri, $blocked_source = false)
     {
       if (!empty($this->config) &&
-	  (($src = $this->config['cid_map'][$uri])
-	   || ($src = $this->config['cid_map'][$this->config['base_url'].$uri]))
+	  (($src = ($this->config['cid_map'][$uri]??null)) ||
+	   ($src = ($this->config['cid_map'][$this->config['base_url'].$uri]??null)))
         ) {
             return $src;
         }
@@ -775,6 +775,7 @@
         $style  = trim($style);
         $strlen = strlen($style);
         $result = array();
+	$q = false;
 
         // explode value
         for ($p=$i=0; $i < $strlen; $i++) {
--- a/program/steps/addressbook/search.inc	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/steps/addressbook/search.inc	Sun Jan 18 14:20:29 2026 -0500
@@ -209,8 +209,8 @@
 
     // search request ID
     $search_request = md5('addr'
-        .(is_array($fields) ? implode($fields, ',') : $fields)
-        .(is_array($search) ? implode($search, ',') : $search));
+			  .(is_array($fields) ? implode(',',$fields) : $fields)
+			  .(is_array($search) ? implode(',',$search) : $search));
 
     // save search settings in session
     $_SESSION['search'][$search_request] = $search_set;
--- a/program/steps/mail/autocomplete.inc	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/steps/mail/autocomplete.inc	Sun Jan 18 14:20:29 2026 -0500
@@ -95,7 +95,7 @@
                     if (empty($contacts[$index])) {
                         $contact = array(
                             'name'   => $contact,
-                            'type'   => $record['_type'],
+                            'type'   => ($record['_type']??null),
                             'id'     => $record['ID'],
                             'source' => $abook_id,
                         );
@@ -105,7 +105,7 @@
                         }
 
                         // groups with defined email address will not be expanded to its members' addresses
-                        if ($record['_type'] == 'group') {
+                        if (($record['_type']??null) == 'group') {
                             $contact['email'] = $email;
                         }
 
--- a/program/steps/mail/get.inc	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/steps/mail/get.inc	Sun Jan 18 14:20:29 2026 -0500
@@ -596,7 +596,7 @@
             $this->body(0, $fp);
             $this->body_file = $filename;
             fclose($fp);
-            @chmod(filename, 0600);
+            @chmod($filename, 0600);
 
             return true;
         }
--- a/program/steps/mail/move_del.inc	Sat Oct 18 12:24:31 2025 -0400
+++ b/program/steps/mail/move_del.inc	Sun Jan 18 14:20:29 2026 -0500
@@ -27,9 +27,10 @@
 // count messages before changing anything
 $threading = (bool) $RCMAIL->storage->get_threading();
 $trash     = $RCMAIL->config->get('trash_mbox');
+$count     = 0;
 $sources   = array();
 
-if ($_POST['_from'] != 'show') {
+if (empty($_POST['_from']) || $_POST['_from'] != 'show') {
     $old_count = $RCMAIL->storage->count(NULL, $threading ? 'THREADS' : 'ALL');
     $old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize());
 }
@@ -105,7 +106,7 @@
     $_SESSION['search'] = $RCMAIL->storage->refresh_search();
 }
 
-if ($_POST['_from'] == 'show') {
+if (!empty($_POST['_from']) && $_POST['_from'] == 'show') {
     if ($next = rcube_utils::get_input_value('_next_uid', rcube_utils::INPUT_GPC)) {
         $OUTPUT->command('show_message', $next);
     }
@@ -160,9 +161,9 @@
 }
 
 // add new rows from next page (if any)
-if ($addrows && $count && $uids != '*' && ($jump_back || $nextpage_count > 0)) {
+  if ($addrows && $count && $uids != '*' && (!empty($jump_back) || $nextpage_count > 0)) {
     // #5862: Don't add more rows than it was on the next page
-    $count = $jump_back ? null : min($nextpage_count, $count);
+    $count = !empty($jump_back) ? null : min($nextpage_count, $count);
 
     $a_headers = $RCMAIL->storage->list_messages($mbox, NULL,
         rcmail_sort_column(), rcmail_sort_order(), $count);