while developing a webmail application, I have encountered a problem in mod_php when querying an imap folder for undeleted messages. I get no results from folders which contain [brackets] in the name. I am under the impression php just wraps the c-client library and that the mail_search_full() function is at fault. Reproducible: Always Steps to Reproduce: 1. <?php $stream = @imap_open($server . $containsbrackets, $user, $pass, OP_READONLY); ?> 2. <?php $msgs=imap_search($stream, 'UNDELETED'); ?> Actual Results: $msgs == false; Expected Results: returned an array of message header ids mod_php compiled with the c-client library. There are definitely messages in the folder with brackets in the name. Renaming the folder to not have brackets allows the array to be returned.
if you quote the brackets, is the expected result returned?
I am not sure precisely what you mean. I have tried the following strings: "{mail.xxxxxx.com:993/imap/ssl/novalidate-cert}INBOX.Lists.[gentoo]" "{mail.xxxxxx.com:993/imap/ssl/novalidate-cert}INBOX.Lists.\"[\"gentoo\"]\"" "{mail.xxxxxx.com:993/imap/ssl/novalidate-cert}INBOX.Lists.\"[gentoo]\"" "{mail.xxxxxx.com:993/imap/ssl/novalidate-cert}INBOX.Lists.\\[gentoo\\]" none of these work (these are actually just examples).
Try one like this: "{mail.xxxxxx.com:993/imap/ssl/novalidate-cert}INBOX.Lists.\[gentoo\]"
I tried it. No luck. I also separately tried using the PHP function imap_utf7_encode() on the connection string before passing it. I didn't really think it would help with these particular characters, and it didn't.
ok, i confirm said bug exists now, and that it's not a php problem, but instead one in c-client itself (I can produce the problem outside of PHP...). I'll ask the c-client mailing list when I get a bit of time.
does this bug still occur with the latest c-client/uw-imap ?
Everything is now working as expected. I am using c-client-2002e. Thank you for your assistance.