diff program/lib/Roundcube/rcube_washtml.php @ 22:303b85d5b561

More cleaning up php8 Warnings/deprecations
author Charlie Root
date Wed, 15 Oct 2025 14:06:27 -0400
parents 73124dd49283
children c32b53434b47
line wrap: on
line diff
--- a/program/lib/Roundcube/rcube_washtml.php	Thu Oct 09 11:31:41 2025 -0400
+++ b/program/lib/Roundcube/rcube_washtml.php	Wed Oct 15 14:06:27 2025 -0400
@@ -215,9 +215,9 @@
     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_flip(self::$html_attribs);
-        $this->_ignore_elements = array_flip((array)$p['ignore_elements']) + array_flip(self::$ignore_elements);
-        $this->_void_elements   = array_flip((array)$p['void_elements']) + array_flip(self::$void_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']);
 
@@ -366,8 +366,9 @@
      */
     private function wash_uri($uri, $blocked_source = false)
     {
-        if (($src = $this->config['cid_map'][$uri])
-            || ($src = $this->config['cid_map'][$this->config['base_url'].$uri])
+      if (!empty($this->config) &&
+	  (($src = $this->config['cid_map'][$uri])
+	   || ($src = $this->config['cid_map'][$this->config['base_url'].$uri]))
         ) {
             return $src;
         }
@@ -455,7 +456,7 @@
             switch ($node->nodeType) {
             case XML_ELEMENT_NODE: //Check element
                 $tagName = strtolower($node->nodeName);
-                if ($callback = $this->handlers[$tagName]) {
+                if ($callback = $this->handlers[$tagName]??null) {
                     $dump .= call_user_func($callback, $tagName,
                         $this->wash_attribs($node), $this->dumpHtml($node, $level), $this);
                 }