changeset 17:dd5ed6ef69c9

Slowly cleaning up more php8 Warnings/deprecations
author Charlie Root
date Mon, 06 Oct 2025 12:20:32 -0400
parents 1866b439e6d3
children b631c1c7a3ce
files program/include/rcmail.php program/lib/Roundcube/rcube_imap.php program/lib/Roundcube/rcube_imap_generic.php program/lib/Roundcube/rcube_plugin.php program/lib/Roundcube/rcube_plugin_api.php program/lib/Roundcube/rcube_result_index.php program/lib/Roundcube/rcube_session.php
diffstat 7 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/program/include/rcmail.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/include/rcmail.php	Mon Oct 06 12:20:32 2025 -0400
@@ -823,7 +823,7 @@
         }
 
         $pre = array();
-        $task = $p['_task'] ?: ($p['task'] ?: $this->task);
+        $task = ($p['_task']??null) ?: ($p['task'] ?: $this->task);
         $pre['_task'] = $task;
         unset($p['task'], $p['_task']);
 
@@ -838,7 +838,7 @@
             }
         }
 
-        $base_path = strval($_SERVER['REDIRECT_SCRIPT_URL'] ?: $_SERVER['SCRIPT_NAME']);
+        $base_path = strval(($_SERVER['REDIRECT_SCRIPT_URL']??null) ?: $_SERVER['SCRIPT_NAME']);
         $base_path = preg_replace('![^/]+$!', '', $base_path);
 
         if ($secure && ($token = $this->get_secure_url_token(true))) {
--- a/program/lib/Roundcube/rcube_imap.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/lib/Roundcube/rcube_imap.php	Mon Oct 06 12:20:32 2025 -0400
@@ -4092,9 +4092,7 @@
     public function update_cache($key, $data)
     {
         if ($cache = $this->get_cache_engine()) {
-	  
             $cache->set($key, $data);
-	    rcube::write_log('mail',"cache " . !(!$cache) . " for " . $key);
         }
     }
 
@@ -4286,7 +4284,7 @@
         $path2 = explode($this->delimiter, $str2);
 
         foreach ($path1 as $idx => $folder1) {
-            $folder2 = $path2[$idx];
+            $folder2 = $path2[$idx]??null;
 
             if ($folder1 === $folder2) {
                 continue;
@@ -4296,7 +4294,8 @@
                 return collator_compare($this->sort_folder_collator, $folder1, $folder2);
             }
 
-            return strcoll($folder1, $folder2);
+	    # HST: I believe null arg used to be arbitrarily 'less' than anything
+            return ($folder2 ? strcoll($folder1, $folder2) : 1);
         }
     }
 
--- a/program/lib/Roundcube/rcube_imap_generic.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/lib/Roundcube/rcube_imap_generic.php	Mon Oct 06 12:20:32 2025 -0400
@@ -1677,7 +1677,7 @@
     public function countUnseen($mailbox)
     {
         // Check internal cache
-        $cache = $this->data['STATUS:'.$mailbox];
+      $cache = ($this->data['STATUS:'.$mailbox]??null);
         if (!empty($cache) && isset($cache['UNSEEN'])) {
             return (int) $cache['UNSEEN'];
         }
--- a/program/lib/Roundcube/rcube_plugin.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/lib/Roundcube/rcube_plugin.php	Mon Oct 06 12:20:32 2025 -0400
@@ -204,6 +204,7 @@
         $langs  = array_unique(array('en_US', $lang));
         $locdir = slashify(realpath(slashify($this->home) . $dir));
         $texts  = array();
+	$messages = null;
 
         // Language aliases used to find localization in similar lang, see below
         $aliases = array(
--- a/program/lib/Roundcube/rcube_plugin_api.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/lib/Roundcube/rcube_plugin_api.php	Mon Oct 06 12:20:32 2025 -0400
@@ -95,7 +95,7 @@
 
         foreach ($this->plugins as $plugin) {
             // ... task, request type and framed mode
-            if (!$this->plugins_initialized[$plugin->ID] && !$this->filter($plugin)) {
+	  if (!($this->plugins_initialized[$plugin->ID]??null) && !$this->filter($plugin)) {
                 $plugin->init();
                 $this->plugins_initialized[$plugin->ID] = $plugin;
             }
@@ -442,7 +442,7 @@
                     $args = $ret + $args;
                 }
 
-                if ($args['break']) {
+                if ($args['break']??null) {
                     break;
                 }
             }
--- a/program/lib/Roundcube/rcube_result_index.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/lib/Roundcube/rcube_result_index.php	Mon Oct 06 12:20:32 2025 -0400
@@ -154,7 +154,7 @@
      */
     public function count()
     {
-        if ($this->meta['count'] !== null)
+      if (($this->meta['count']??null) !== null)
             return $this->meta['count'];
 
         if (empty($this->raw_data)) {
--- a/program/lib/Roundcube/rcube_session.php	Mon Oct 06 10:34:51 2025 -0400
+++ b/program/lib/Roundcube/rcube_session.php	Mon Oct 06 12:20:32 2025 -0400
@@ -36,6 +36,8 @@
     protected $start;
     protected $vars;
     protected $now;
+    protected $cookie;
+    protected $lifetime;
     protected $time_diff    = 0;
     protected $reloaded     = false;
     protected $appends      = array();