Mercurial > hg > rc2
diff program/lib/Roundcube/rcube_imap_generic.php @ 16:1866b439e6d3
Slowly cleaning up more php8 Warnings/deprecations
| author | Charlie Root |
|---|---|
| date | Mon, 06 Oct 2025 10:34:51 -0400 |
| parents | 85a746e95663 |
| children | dd5ed6ef69c9 |
line wrap: on
line diff
--- a/program/lib/Roundcube/rcube_imap_generic.php Sat Sep 20 12:16:50 2025 -0400 +++ b/program/lib/Roundcube/rcube_imap_generic.php Mon Oct 06 10:34:51 2025 -0400 @@ -144,7 +144,9 @@ $res = 0; if ($parts = preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) { for ($i=0, $cnt=count($parts); $i<$cnt; $i++) { - if (preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i+1], $matches)) { + if (($parts[$i+1]??null) && + preg_match('/^\{([0-9]+)\}\r\n$/', + $parts[$i+1], $matches)) { // LITERAL+ support if ($this->prefs['literal+']) { $parts[$i+1] = sprintf("{%d+}\r\n", $matches[1]); @@ -199,7 +201,7 @@ do { if ($this->eof()) { - return $line ?: null; + return $line ?: null; } $buffer = fgets($this->fp, $size); @@ -1506,6 +1508,9 @@ $rets = array_intersect($return_opts, $ext_opts); $return_opts = array_diff($return_opts, $rets); } + else { + $ext_opts = $rets = $return_opts = null; + } if (!empty($return_opts) && $this->getCapability('LIST-STATUS')) { $lstatus = true; @@ -1521,6 +1526,9 @@ $rets = array_merge($rets, $opts); } } + else { + $lstatus = $opts = $status_opts = $rets = null; + } if (!empty($rets)) { $args[] = 'RETURN (' . implode(' ', $rets) . ')'; @@ -1617,7 +1625,7 @@ } // Check internal cache - $cache = $this->data['STATUS:'.$mailbox]; + $cache = ($this->data['STATUS:'.$mailbox]??null); if (!empty($cache) && isset($cache['MESSAGES'])) { return (int) $cache['MESSAGES']; } @@ -2163,7 +2171,8 @@ return null; } - if ($uid = $this->data['UID-MAP'][$id]) { + if (($map = ( $this->data['UID-MAP'] ?? null) ) && + ($uid = ( $map[$id] ?? null ) ) ) { return $uid; } @@ -2428,7 +2437,9 @@ } // Tokenize response and assign to object properties - while (list($name, $value) = $this->tokenizeResponse($line, 2)) { + while ($token = $this->tokenizeResponse($line, 2)) { + list($name, $value) = $token; + if ($name == 'UID') { $result[$id]->uid = intval($value); } @@ -2473,7 +2484,7 @@ if ($name == 'HEADER.FIELDS') { // skip ']' after headers list - $this->tokenizeResponse($line, 1); + $this->tokenizeResponse($line, 1); $headers = $this->tokenizeResponse($line, 1); } else if (strlen($name)) { @@ -2483,6 +2494,7 @@ $result[$id]->body = $value; } } + } // create array with header field:data
