Opened 5 years ago

Closed 5 years ago

#1485527 closed Bugs (fixed)

"Unknown Server Error" with numerical-only IMAP folder names

Reported by: mattjgalloway Owned by:
Priority: 5 Milestone: 0.2-stable
Component: PHP backend Version: 0.2-beta
Severity: normal Keywords:
Cc:

Description

I found a bug whereby if you have folders with purely numeric names (such as 2007 or 2008) then the AJAX request gets confused as the json_serialize function in rcube_shared.inc decides that the string is numeric and therefore doesn't put the folder name in quotes.

I fixed it on my server with the following changes.

program/steps/mail/getunread.inc:

$OUTPUT->command('set_unread_count', $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'), ($IMAP->get_mailbox_name() == 'INBOX' && $mbox_row == 'INBOX'));


goes to

$OUTPUT->command('set_unread_count', (string)$mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'), ($IMAP->get_mailbox_name() == 'INBOX' && $mbox_row == 'INBOX'));

program/include/rcube_shared.inc:json_serialize($var):[[BR]]

else if (is_numeric($var) && strval(intval($var)) === strval($var))


goes to

else if (is_numeric($var) && (strval(intval($var)) === strval($var)) && (!is_string($var)))

It might be better to fix it in a cleaner way, although I actually think this is probably the cleanest method anyway.

Regards,
Matt Galloway

Change History (2)

comment:1 Changed 5 years ago by alec

  • Milestone changed from later to 0.2-stable

comment:2 Changed 5 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [8498dce5]. Slightly different, because there were other problems with numeric folder names.

Note: See TracTickets for help on using tickets.