squirrelmail/functions/imap_mailbox.php at lines 711 - 722 contains
/* Find INBOX */
$cnt = count($boxesall);
$used = array_pad($used,$cnt,false);
foreach ($boxesall as $k => $b)
// was this but array not guaranteed to be contiguous: for($k = 0; $k < $cnt; ++$k)
{
if (strtolower($boxesall[$k]['unformatted']) == 'inbox') {
$boxesnew[] = $boxesall[$k];
$used[$k] = true;
break;
}
}
The problem with this code is that as noted $boxesall may not be contiguous. Therefore, the largest key ($k) in the $boxesall array can be bigger than count($boxesall), but $used is only padded out to $cnt = count($boxesall) so there can be keys for which $used[$k] is undefined.
I fixed this with
--- .software/squirrelmail.stable/squirrelmail/functions/imap_mailbox.php 2017-01-27 12:31:33.000000000 -0800
+++ /usr/share/squirrelmail/functions/imap_mailbox.php 2017-03-02 23:50:24.859018257 -0800
@@ -709,7 +709,8 @@
$boxesnew = $used = array();
/* Find INBOX */
- $cnt = count($boxesall);
+ // was $cnt = count($boxesall); but $boxesall may not be contiguous
+ $cnt = max(array_keys($boxesall)) + 1;
$used = array_pad($used,$cnt,false);
foreach ($boxesall as $k => $b)
// was this but array not guaranteed to be contiguous: for($k = 0; $k < $cnt; ++$k)