Connecting to an Exchange 2007 server via imap, listMessages() returned an empty array. Reason: the IMAP response line that is being matched in line 1217 had an extra trailing whitespace.
Changing the regex in line 1217 to match the possible trailing whitespace worked for me:
if (preg_match('#^\s*\*\s+STATUS\s+"?INBOX"?\s+\((.*)\)\s+$#', $line, $match)) {
Any idea if the trailing whitespace is an issue of the Exchange servers config?