unable to toggle read status when first logging in

Charles McNulty charles at charlesmcnulty.com
Tue May 2 00:24:35 CEST 2006

Thomas Bruederli wrote:
> I cannot reproduce this behavior. However, I added the following to
> program/steps/mail/func.inc to make sure that the correct mailbox is
> stored within the session:
> if (empty($_SESSION['mbox']))
>   $_SESSION['mbox'] = $IMAP->get_mailbox_name();
> Regards,
> Thomas

I couldn't get this patch to work, and in fact I don't believe from 
looking at it that it would address the issue.  The only place anywhere 
in the code that $_SESSION['mbox'] is set is in func.inc:

// set imap properties and session vars
if (strlen($_GET['_mbox']))
   $_SESSION['mbox'] = $_GET['_mbox'];

If I put your snippet before this it would just be overwritten, and if I 
put it after it would overwrite it with an incorrect value.

The really weird thing about this bug is that when I log $_GET['_mbox'], 
I'm never able to observe _GET as the wrong value (the last value in the 
folders array).  I logged dozens of lines of code to try to pinpoint 
where else $_SESSION['mbox'] was being assigned and I just couldn't find 

To summarize the issues, the bug can be observed by following these steps:

1) Login
2) Click on the 'Round Cube Webmail' icon on the top left corner
3) Mark any Read message as Unread - Observe that the Unread number does 
not change in the folder list
4) Navigate to another folder by clicking on it on the left column
5) Navigate back to the Inbox - Observe that the Unread status has not 
been saved 6) repeat step 3. Observe that the Unread number now *does* 
change and that the status is correctly saved.

The problem is that the program is attempting to flag a message in a 
mailbox that doesn't exist because it's looking in the wrong mailbox. 
It's looking in the mailbox that's stored in the SESSION['mbox'] and the 
SESSION['mbox'] is inexplicably set to the last value in the array 
$rcmail_config['default_imap_folders'] defined in main.inc.php.

SESSION['mbox'] is only ever explicitly set in func.inc where it is 
assigned to a $_GET value.

I know this is hard to follow, but if anyone who can reproduce the error 
has any time to look at it or a decent way to work around it, I'd really 
appreciate it!


More information about the Dev mailing list